Skip to content

Commit

Permalink
doc: improve buf.lastIndexOf() text
Browse files Browse the repository at this point in the history
Improve description of `encoding` option. (This change is also applied
to `buf.indexOf()`.) Improve punctuation. Wrap at 80 characters.

PR-URL: #19904
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
  • Loading branch information
Trott authored and MylesBorins committed Aug 17, 2018
1 parent 246c2d1 commit 4a795dd
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -1325,11 +1325,12 @@ changes:
-->

* `value` {string|Buffer|Uint8Array|integer} What to search for.
* `byteOffset` {integer} Where to begin searching in `buf`. **Default:** `0`
* `encoding` {string} If `value` is a string, this is its encoding.
**Default:** `'utf8'`
* Returns: {integer} The index of the first occurrence of `value` in `buf` or `-1`
if `buf` does not contain `value`.
* `byteOffset` {integer} Where to begin searching in `buf`. **Default:** `0`.
* `encoding` {string} If `value` is a string, this is the encoding used to
determine the binary representation of the string that will be searched for in
`buf`. **Default:** `'utf8'`.
* Returns: {integer} The index of the first occurrence of `value` in `buf`, or
`-1` if `buf` does not contain `value`.

If `value` is:

Expand Down Expand Up @@ -1438,14 +1439,15 @@ changes:

* `value` {string|Buffer|Uint8Array|integer} What to search for.
* `byteOffset` {integer} Where to begin searching in `buf`.
**Default:** [`buf.length`]` - 1`
* `encoding` {string} If `value` is a string, this is its encoding.
**Default:** `'utf8'`
* Returns: {integer} The index of the last occurrence of `value` in `buf` or `-1`
if `buf` does not contain `value`.

Identical to [`buf.indexOf()`], except `buf` is searched from back to front
instead of front to back.
**Default:** [`buf.length`]` - 1`.
* `encoding` {string} If `value` is a string, this is the encoding used to
determine the binary representation of the string that will be searched for in
`buf`. **Default:** `'utf8'`.
* Returns: {integer} The index of the last occurrence of `value` in `buf`, or
`-1` if `buf` does not contain `value`.

Identical to [`buf.indexOf()`], except the last occurrence of `value` is found
rather than the first occurrence.

Examples:

Expand Down

0 comments on commit 4a795dd

Please sign in to comment.