Skip to content

Commit 60e9123

Browse files
committed
doc: improve buf.indexOf() documentation style
* improve usage of "coerce" in buffer.md * reduce informal tone in buffer.md * wrap line at 80 characters in buffer.md * wrap value in backtick for consistency
1 parent 9a6dd07 commit 60e9123

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

doc/api/buffer.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,10 +1258,10 @@ changes:
12581258

12591259
* `value` {string|Buffer|Uint8Array|integer} What to search for.
12601260
* `byteOffset` {integer} Where to begin searching in `buf`. **Default:** `0`.
1261-
* `encoding` {string} If `value` is a string, this is its encoding.
1261+
* `encoding` {string} The encoding of `value` if `value` is a string.
12621262
**Default:** `'utf8'`.
1263-
* Returns: {integer} The index of the first occurrence of `value` in `buf` or `-1`
1264-
if `buf` does not contain `value`.
1263+
* Returns: {integer} The index of the first occurrence of `value` in `buf` or
1264+
`-1` if `buf` does not contain `value`.
12651265

12661266
If `value` is:
12671267

@@ -1300,9 +1300,9 @@ If `value` is not a string, number, or `Buffer`, this method will throw a
13001300
`TypeError`. If `value` is a number, it will be coerced to a valid byte value,
13011301
an integer between 0 and 255.
13021302

1303-
If `byteOffset` is not a number, it will be coerced to a number. Any arguments
1304-
that coerce to `NaN` or 0, like `{}`, `[]`, `null` or `undefined`, will search
1305-
the whole buffer. This behavior matches [`String#indexOf()`].
1303+
If `byteOffset` is not a number, it will be coerced to a number. If the result
1304+
of coercion is `NaN` or `0`, then the entire buffer will be searched. This
1305+
behavior matches [`String#indexOf()`].
13061306

13071307
```js
13081308
const b = Buffer.from('abcdef');

0 commit comments

Comments
 (0)