Skip to content

Commit 538a988

Browse files
authored
Merge pull request #60 from reconbot/reconbot/indexof-readme
Add indexOf docs
2 parents 635b6ce + d8d8647 commit 538a988

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ console.log(bl.slice(3, 6).toString('ascii')) // 'def'
2929
console.log(bl.slice(3, 8).toString('ascii')) // 'defgh'
3030
console.log(bl.slice(5, 10).toString('ascii')) // 'fghij'
3131

32+
console.log(bl.indexOf('def')) // 3
33+
console.log(bl.indexOf('asdf')) // -1
34+
3235
// or just use toString!
3336
console.log(bl.toString()) // 'abcdefghij\u0003\u0004'
3437
console.log(bl.toString('ascii', 3, 8)) // 'defgh'
@@ -86,6 +89,7 @@ bl.pipe(fs.createWriteStream('gibberish.txt'))
8689
* <a href="#length"><code>bl.<b>length</b></code></a>
8790
* <a href="#append"><code>bl.<b>append(buffer)</b></code></a>
8891
* <a href="#get"><code>bl.<b>get(index)</b></code></a>
92+
* <a href="#indexOf"><code>bl.<b>indexOf(value[, byteOffset][, encoding])</b></code></a>
8993
* <a href="#slice"><code>bl.<b>slice([ start[, end ] ])</b></code></a>
9094
* <a href="#shallowSlice"><code>bl.<b>shallowSlice([ start[, end ] ])</b></code></a>
9195
* <a href="#copy"><code>bl.<b>copy(dest, [ destStart, [ srcStart [, srcEnd ] ] ])</b></code></a>
@@ -129,6 +133,12 @@ Get the length of the list in bytes. This is the sum of the lengths of all of th
129133
### bl.get(index)
130134
`get()` will return the byte at the specified index.
131135

136+
--------------------------------------------------------
137+
<a name="indexOf"></a>
138+
### bl.indexOf(value[, byteOffset][, encoding])
139+
`get()` will return the byte at the specified index.
140+
`indexOf()` method returns the first index at which a given element can be found in the BufferList, or -1 if it is not present.
141+
132142
--------------------------------------------------------
133143
<a name="slice"></a>
134144
### bl.slice([ start, [ end ] ])

0 commit comments

Comments
 (0)