Skip to content

Commit 5983cef

Browse files
vsemozhetbytBethGriggs
authored andcommitted
doc: add notes about negative offsets in buffer.md
PR-URL: #27030 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Signed-off-by: Beth Griggs <Bethany.Griggs@uk.ibm.com>
1 parent 3567ff1 commit 5983cef

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

doc/api/buffer.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -1281,7 +1281,8 @@ added: v5.3.0
12811281
-->
12821282

12831283
* `value` {string|Buffer|Uint8Array|integer} What to search for.
1284-
* `byteOffset` {integer} Where to begin searching in `buf`. **Default:** `0`.
1284+
* `byteOffset` {integer} Where to begin searching in `buf`. If negative, then
1285+
offset is calculated from the end of `buf`. **Default:** `0`.
12851286
* `encoding` {string} If `value` is a string, this is its encoding.
12861287
**Default:** `'utf8'`.
12871288
* Returns: {boolean} `true` if `value` was found in `buf`, `false` otherwise.
@@ -1321,7 +1322,8 @@ changes:
13211322
-->
13221323

13231324
* `value` {string|Buffer|Uint8Array|integer} What to search for.
1324-
* `byteOffset` {integer} Where to begin searching in `buf`. **Default:** `0`.
1325+
* `byteOffset` {integer} Where to begin searching in `buf`. If negative, then
1326+
offset is calculated from the end of `buf`. **Default:** `0`.
13251327
* `encoding` {string} If `value` is a string, this is the encoding used to
13261328
determine the binary representation of the string that will be searched for in
13271329
`buf`. **Default:** `'utf8'`.
@@ -1423,8 +1425,9 @@ changes:
14231425
-->
14241426

14251427
* `value` {string|Buffer|Uint8Array|integer} What to search for.
1426-
* `byteOffset` {integer} Where to begin searching in `buf`.
1427-
**Default:** [`buf.length`]` - 1`.
1428+
* `byteOffset` {integer} Where to begin searching in `buf`. If negative, then
1429+
offset is calculated from the end of `buf`. **Default:**
1430+
[`buf.length`]` - 1`.
14281431
* `encoding` {string} If `value` is a string, this is the encoding used to
14291432
determine the binary representation of the string that will be searched for in
14301433
`buf`. **Default:** `'utf8'`.

0 commit comments

Comments
 (0)