Skip to content

tools/doc: improvements for types #11167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 44 additions & 44 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,8 @@ changes:
> Stability: 0 - Deprecated:
> Use [`Buffer.from(string[, encoding])`][`Buffer.from(string)`] instead.

* `string` {String} String to encode
* `encoding` {String} The encoding of `string`. **Default:** `'utf8'`
* `string` {string} String to encode
* `encoding` {string} The encoding of `string`. **Default:** `'utf8'`

Creates a new `Buffer` containing the given JavaScript string `string`. If
provided, the `encoding` parameter identifies the character encoding of `string`.
Expand Down Expand Up @@ -508,9 +508,9 @@ added: v5.10.0
-->

* `size` {Integer} The desired length of the new `Buffer`
* `fill` {String | Buffer | Integer} A value to pre-fill the new `Buffer` with.
* `fill` {string | Buffer | Integer} A value to pre-fill the new `Buffer` with.
**Default:** `0`
* `encoding` {String} If `fill` is a string, this is its encoding.
* `encoding` {string} If `fill` is a string, this is its encoding.
**Default:** `'utf8'`

Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the
Expand Down Expand Up @@ -674,9 +674,9 @@ changes:
or `ArrayBuffer`.
-->

* `string` {String | Buffer | TypedArray | DataView | ArrayBuffer} A value to
* `string` {string | Buffer | TypedArray | DataView | ArrayBuffer} A value to
calculate the length of
* `encoding` {String} If `string` is a string, this is its encoding.
* `encoding` {string} If `string` is a string, this is its encoding.
**Default:** `'utf8'`
* Returns: {Integer} The number of bytes contained within `string`

Expand Down Expand Up @@ -876,8 +876,8 @@ A `TypeError` will be thrown if `buffer` is not a `Buffer`.
added: v5.10.0
-->

* `string` {String} A string to encode.
* `encoding` {String} The encoding of `string`. **Default:** `'utf8'`
* `string` {string} A string to encode.
* `encoding` {string} The encoding of `string`. **Default:** `'utf8'`

Creates a new `Buffer` containing the given JavaScript string `string`. If
provided, the `encoding` parameter identifies the character encoding of `string`.
Expand Down Expand Up @@ -917,7 +917,7 @@ Returns `true` if `obj` is a `Buffer`, `false` otherwise.
added: v0.9.1
-->

* `encoding` {String} A character encoding name to check
* `encoding` {string} A character encoding name to check
* Returns: {Boolean}

Returns `true` if `encoding` contains a supported character encoding, or `false`
Expand Down Expand Up @@ -1170,10 +1170,10 @@ changes:
description: The `encoding` parameter is supported now.
-->

* `value` {String | Buffer | Integer} The value to fill `buf` with
* `value` {string | Buffer | Integer} The value to fill `buf` with
* `offset` {Integer} Where to start filling `buf`. **Default:** `0`
* `end` {Integer} Where to stop filling `buf` (not inclusive). **Default:** [`buf.length`]
* `encoding` {String} If `value` is a string, this is its encoding.
* `encoding` {string} If `value` is a string, this is its encoding.
**Default:** `'utf8'`
* Returns: {Buffer} A reference to `buf`

Expand Down Expand Up @@ -1207,9 +1207,9 @@ console.log(Buffer.allocUnsafe(3).fill('\u0222'));
added: v5.3.0
-->

* `value` {String | Buffer | Integer} What to search for
* `value` {string | Buffer | 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.
* `encoding` {string} If `value` is a string, this is its encoding.
**Default:** `'utf8'`
* Returns: {Boolean} `true` if `value` was found in `buf`, `false` otherwise

Expand Down Expand Up @@ -1256,9 +1256,9 @@ changes:
is no longer required.
-->

* `value` {String | Buffer | Uint8Array | Integer} What to search for
* `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.
* `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`
Expand Down Expand Up @@ -1365,10 +1365,10 @@ changes:
description: The `value` can now be a `Uint8Array`.
-->

* `value` {String | Buffer | Uint8Array | Integer} What to search for
* `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.
* `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`
Expand Down Expand Up @@ -1501,7 +1501,7 @@ added: v0.11.15
-->

* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 8`
* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false`
* `noAssert` {boolean} Skip `offset` validation? **Default:** `false`
* Returns: {Number}

Reads a 64-bit double from `buf` at the specified `offset` with specified
Expand Down Expand Up @@ -1537,7 +1537,7 @@ added: v0.11.15
-->

* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4`
* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false`
* `noAssert` {boolean} Skip `offset` validation? **Default:** `false`
* Returns: {Number}

Reads a 32-bit float from `buf` at the specified `offset` with specified
Expand Down Expand Up @@ -1572,7 +1572,7 @@ added: v0.5.0
-->

* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 1`
* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false`
* `noAssert` {boolean} Skip `offset` validation? **Default:** `false`
* Returns: {Integer}

Reads a signed 8-bit integer from `buf` at the specified `offset`.
Expand Down Expand Up @@ -1604,7 +1604,7 @@ added: v0.5.5
-->

* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 2`
* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false`
* `noAssert` {boolean} Skip `offset` validation? **Default:** `false`
* Returns: {Integer}

Reads a signed 16-bit integer from `buf` at the specified `offset` with
Expand Down Expand Up @@ -1638,7 +1638,7 @@ added: v0.5.5
-->

* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4`
* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false`
* `noAssert` {boolean} Skip `offset` validation? **Default:** `false`
* Returns: {Integer}

Reads a signed 32-bit integer from `buf` at the specified `offset` with
Expand Down Expand Up @@ -1673,7 +1673,7 @@ added: v0.11.15

* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - byteLength`
* `byteLength` {Integer} How many bytes to read. Must satisfy: `0 < byteLength <= 6`
* `noAssert` {Boolean} Skip `offset` and `byteLength` validation? **Default:** `false`
* `noAssert` {boolean} Skip `offset` and `byteLength` validation? **Default:** `false`
* Returns: {Integer}

Reads `byteLength` number of bytes from `buf` at the specified `offset`
Expand Down Expand Up @@ -1704,7 +1704,7 @@ added: v0.5.0
-->

* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 1`
* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false`
* `noAssert` {boolean} Skip `offset` validation? **Default:** `false`
* Returns: {Integer}

Reads an unsigned 8-bit integer from `buf` at the specified `offset`.
Expand Down Expand Up @@ -1734,7 +1734,7 @@ added: v0.5.5
-->

* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 2`
* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false`
* `noAssert` {boolean} Skip `offset` validation? **Default:** `false`
* Returns: {Integer}

Reads an unsigned 16-bit integer from `buf` at the specified `offset` with
Expand Down Expand Up @@ -1772,7 +1772,7 @@ added: v0.5.5
-->

* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4`
* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false`
* `noAssert` {boolean} Skip `offset` validation? **Default:** `false`
* Returns: {Integer}

Reads an unsigned 32-bit integer from `buf` at the specified `offset` with
Expand Down Expand Up @@ -1805,7 +1805,7 @@ added: v0.11.15

* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - byteLength`
* `byteLength` {Integer} How many bytes to read. Must satisfy: `0 < byteLength <= 6`
* `noAssert` {Boolean} Skip `offset` and `byteLength` validation? **Default:** `false`
* `noAssert` {boolean} Skip `offset` and `byteLength` validation? **Default:** `false`
* Returns: {Integer}

Reads `byteLength` number of bytes from `buf` at the specified `offset`
Expand Down Expand Up @@ -2025,7 +2025,7 @@ console.log(copy);
added: v0.1.90
-->

* `encoding` {String} The character encoding to decode to. **Default:** `'utf8'`
* `encoding` {string} The character encoding to decode to. **Default:** `'utf8'`
* `start` {Integer} The byte offset to start decoding at. **Default:** `0`
* `end` {Integer} The byte offset to stop decoding at (not inclusive).
**Default:** [`buf.length`]
Expand Down Expand Up @@ -2106,10 +2106,10 @@ for (const value of buf) {
added: v0.1.90
-->

* `string` {String} String to be written to `buf`
* `string` {string} String to be written to `buf`
* `offset` {Integer} Where to start writing `string`. **Default:** `0`
* `length` {Integer} How many bytes to write. **Default:** `buf.length - offset`
* `encoding` {String} The character encoding of `string`. **Default:** `'utf8'`
* `encoding` {string} The character encoding of `string`. **Default:** `'utf8'`
* Returns: {Integer} Number of bytes written

Writes `string` to `buf` at `offset` according to the character encoding in `encoding`.
Expand All @@ -2134,9 +2134,9 @@ console.log(`${len} bytes: ${buf.toString('utf8', 0, len)}`);
added: v0.11.15
-->

* `value` {Number} Number to be written to `buf`
* `value` {number} Number to be written to `buf`
* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 8`
* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false`
* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false`
* Returns: {Integer} `offset` plus the number of bytes written

Writes `value` to `buf` at the specified `offset` with specified endian
Expand Down Expand Up @@ -2169,9 +2169,9 @@ console.log(buf);
added: v0.11.15
-->

* `value` {Number} Number to be written to `buf`
* `value` {number} Number to be written to `buf`
* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4`
* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false`
* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false`
* Returns: {Integer} `offset` plus the number of bytes written

Writes `value` to `buf` at the specified `offset` with specified endian
Expand Down Expand Up @@ -2205,7 +2205,7 @@ added: v0.5.0

* `value` {Integer} Number to be written to `buf`
* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 1`
* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false`
* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false`
* Returns: {Integer} `offset` plus the number of bytes written

Writes `value` to `buf` at the specified `offset`. `value` *should* be a valid
Expand Down Expand Up @@ -2237,7 +2237,7 @@ added: v0.5.5

* `value` {Integer} Number to be written to `buf`
* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 2`
* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false`
* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false`
* Returns: {Integer} `offset` plus the number of bytes written

Writes `value` to `buf` at the specified `offset` with specified endian
Expand Down Expand Up @@ -2270,7 +2270,7 @@ added: v0.5.5

* `value` {Integer} Number to be written to `buf`
* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4`
* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false`
* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false`
* Returns: {Integer} `offset` plus the number of bytes written

Writes `value` to `buf` at the specified `offset` with specified endian
Expand Down Expand Up @@ -2304,7 +2304,7 @@ added: v0.11.15
* `value` {Integer} Number to be written to `buf`
* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - byteLength`
* `byteLength` {Integer} How many bytes to write. Must satisfy: `0 < byteLength <= 6`
* `noAssert` {Boolean} Skip `value`, `offset`, and `byteLength` validation?
* `noAssert` {boolean} Skip `value`, `offset`, and `byteLength` validation?
**Default:** `false`
* Returns: {Integer} `offset` plus the number of bytes written

Expand Down Expand Up @@ -2338,7 +2338,7 @@ added: v0.5.0

* `value` {Integer} Number to be written to `buf`
* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 1`
* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false`
* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false`
* Returns: {Integer} `offset` plus the number of bytes written

Writes `value` to `buf` at the specified `offset`. `value` *should* be a
Expand Down Expand Up @@ -2370,7 +2370,7 @@ added: v0.5.5

* `value` {Integer} Number to be written to `buf`
* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 2`
* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false`
* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false`
* Returns: {Integer} `offset` plus the number of bytes written

Writes `value` to `buf` at the specified `offset` with specified endian
Expand Down Expand Up @@ -2407,7 +2407,7 @@ added: v0.5.5

* `value` {Integer} Number to be written to `buf`
* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4`
* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false`
* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false`
* Returns: {Integer} `offset` plus the number of bytes written

Writes `value` to `buf` at the specified `offset` with specified endian
Expand Down Expand Up @@ -2443,7 +2443,7 @@ added: v0.5.5
* `value` {Integer} Number to be written to `buf`
* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - byteLength`
* `byteLength` {Integer} How many bytes to write. Must satisfy: `0 < byteLength <= 6`
* `noAssert` {Boolean} Skip `value`, `offset`, and `byteLength` validation?
* `noAssert` {boolean} Skip `value`, `offset`, and `byteLength` validation?
**Default:** `false`
* Returns: {Integer} `offset` plus the number of bytes written

Expand Down Expand Up @@ -2507,8 +2507,8 @@ changes:
-->

* `source` {Buffer|Uint8Array} A `Buffer` or `Uint8Array` instance
* `fromEnc` {String} The current encoding
* `toEnc` {String} To target encoding
* `fromEnc` {string} The current encoding
* `toEnc` {string} To target encoding

Re-encodes the given `Buffer` or `Uint8Array` instance from one character
encoding to another. Returns a new `Buffer` instance.
Expand Down
Loading