diff options
author | Rich Trott <rtrott@gmail.com> | 2018-04-10 01:43:29 +0300 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2018-08-17 23:14:13 +0300 |
commit | 4a795dd084e8f27738b37ca6f577aff85eae0971 (patch) | |
tree | 30bc9ff1e1eeb1b60ada64266cf8d297cbafc09a /doc | |
parent | 246c2d18cb5cf7ff7b3952b15e49034f25bc0c4c (diff) |
doc: improve buf.lastIndexOf() text
Improve description of `encoding` option. (This change is also applied
to `buf.indexOf()`.) Improve punctuation. Wrap at 80 characters.
PR-URL: https://github.com/nodejs/node/pull/19904
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/buffer.md | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 18209a81d26..1a94d4c15dc 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -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: @@ -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: |