Skip to content
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

doc: consistent 'Returns:' #9554

Closed
wants to merge 1 commit 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
84 changes: 42 additions & 42 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ added: v0.1.90
calculate the length of
* `encoding` {String} If `string` is a string, this is its encoding.
**Default:** `'utf8'`
* Return: {Integer} The number of bytes contained within `string`
* Returns: {Integer} The number of bytes contained within `string`

Returns the actual byte length of a string. This is not the same as
[`String.prototype.length`] since that returns the number of *characters* in
Expand All @@ -638,7 +638,7 @@ added: v0.11.13

* `buf1` {Buffer}
* `buf2` {Buffer}
* Return: {Integer}
* Returns: {Integer}

Compares `buf1` to `buf2` typically for the purpose of sorting arrays of
`Buffer` instances. This is equivalent to calling
Expand All @@ -664,7 +664,7 @@ added: v0.7.11
* `list` {Array} List of `Buffer` instances to concat
* `totalLength` {Integer} Total length of the `Buffer` instances in `list`
when concatenated
* Return: {Buffer}
* Returns: {Buffer}

Returns a new `Buffer` which is the result of concatenating all the `Buffer`
instances in the `list` together.
Expand Down Expand Up @@ -829,7 +829,7 @@ added: v0.1.101
-->

* `obj` {Object}
* Return: {Boolean}
* Returns: {Boolean}

Returns `true` if `obj` is a `Buffer`, `false` otherwise.

Expand All @@ -839,7 +839,7 @@ added: v0.9.1
-->

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

Returns `true` if `encoding` contains a supported character encoding, or `false`
otherwise.
Expand Down Expand Up @@ -894,7 +894,7 @@ added: v0.11.13
* `sourceEnd` {Integer} The offset within `buf` at which to end comparison
(not inclusive). Ignored when `targetStart` is `undefined`.
**Default:** [`buf.length`]
* Return: {Integer}
* Returns: {Integer}

Compares `buf` with `target` and returns a number indicating whether `buf`
comes before, after, or is the same as `target` in sort order.
Expand Down Expand Up @@ -966,7 +966,7 @@ added: v0.1.90
Ignored when `targetStart` is `undefined`. **Default:** `0`
* `sourceEnd` {Integer} The offset within `buf` at which to stop copying (not
inclusive). Ignored when `sourceStart` is `undefined`. **Default:** [`buf.length`]
* Return: {Integer} The number of bytes copied.
* Returns: {Integer} The number of bytes copied.

Copies data from a region of `buf` to a region in `target` even if the `target`
memory region overlaps with `buf`.
Expand Down Expand Up @@ -1011,7 +1011,7 @@ console.log(buf.toString());
added: v1.1.0
-->

* Return: {Iterator}
* Returns: {Iterator}

Creates and returns an [iterator] of `[index, byte]` pairs from the contents of
`buf`.
Expand Down Expand Up @@ -1039,7 +1039,7 @@ added: v0.11.13
-->

* `otherBuffer` {Buffer} A `Buffer` to compare to
* Return: {Boolean}
* Returns: {Boolean}

Returns `true` if both `buf` and `otherBuffer` have exactly the same bytes,
`false` otherwise.
Expand Down Expand Up @@ -1068,7 +1068,7 @@ added: v0.5.0
* `end` {Integer} Where to stop filling `buf` (not inclusive). **Default:** [`buf.length`]
* `encoding` {String} If `value` is a string, this is its encoding.
**Default:** `'utf8'`
* Return: {Buffer} A reference to `buf`
* Returns: {Buffer} A reference to `buf`

Fills `buf` with the specified `value`. If the `offset` and `end` are not given,
the entire `buf` will be filled. This is meant to be a small simplification to
Expand Down Expand Up @@ -1104,7 +1104,7 @@ added: v1.5.0
* `byteOffset` {Integer} Where to begin searching in `buf`. **Default:** `0`
* `encoding` {String} If `value` is a string, this is its encoding.
**Default:** `'utf8'`
* Return: {Integer} The index of the first occurrence of `value` in `buf` or `-1`
* 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 @@ -1159,7 +1159,7 @@ added: v5.3.0
* `byteOffset` {Integer} Where to begin searching in `buf`. **Default:** `0`
* `encoding` {String} If `value` is a string, this is its encoding.
**Default:** `'utf8'`
* Return: {Boolean} `true` if `value` was found in `buf`, `false` otherwise
* Returns: {Boolean} `true` if `value` was found in `buf`, `false` otherwise

Equivalent to [`buf.indexOf() !== -1`][`buf.indexOf()`].

Expand Down Expand Up @@ -1196,7 +1196,7 @@ console.log(buf.includes('this', 4));
added: v1.1.0
-->

* Return: {Iterator}
* Returns: {Iterator}

Creates and returns an [iterator] of `buf` keys (indices).

Expand Down Expand Up @@ -1227,7 +1227,7 @@ added: v6.0.0
**Default:** [`buf.length`]
* `encoding` {String} If `value` is a string, this is its encoding.
**Default:** `'utf8'`
* Return: {Integer} The index of the last occurrence of `value` in `buf` or `-1`
* 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
Expand Down Expand Up @@ -1323,7 +1323,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`
* Return: {Number}
* Returns: {Number}

Reads a 64-bit double from `buf` at the specified `offset` with specified
endian format (`readDoubleBE()` returns big endian, `readDoubleLE()` returns
Expand Down Expand Up @@ -1359,7 +1359,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`
* Return: {Number}
* Returns: {Number}

Reads a 32-bit float from `buf` at the specified `offset` with specified
endian format (`readFloatBE()` returns big endian, `readFloatLE()` returns
Expand Down Expand Up @@ -1394,7 +1394,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`
* Return: {Integer}
* Returns: {Integer}

Reads a signed 8-bit integer from `buf` at the specified `offset`.

Expand Down Expand Up @@ -1426,7 +1426,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`
* Return: {Integer}
* Returns: {Integer}

Reads a signed 16-bit integer from `buf` at the specified `offset` with
the specified endian format (`readInt16BE()` returns big endian,
Expand Down Expand Up @@ -1460,7 +1460,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`
* Return: {Integer}
* Returns: {Integer}

Reads a signed 32-bit integer from `buf` at the specified `offset` with
the specified endian format (`readInt32BE()` returns big endian,
Expand Down Expand Up @@ -1495,7 +1495,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`
* Return: {Integer}
* Returns: {Integer}

Reads `byteLength` number of bytes from `buf` at the specified `offset`
and interprets the result as a two's complement signed value. Supports up to 48
Expand Down Expand Up @@ -1526,7 +1526,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`
* Return: {Integer}
* Returns: {Integer}

Reads an unsigned 8-bit integer from `buf` at the specified `offset`.

Expand Down Expand Up @@ -1556,7 +1556,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`
* Return: {Integer}
* Returns: {Integer}

Reads an unsigned 16-bit integer from `buf` at the specified `offset` with
specified endian format (`readUInt16BE()` returns big endian, `readUInt16LE()`
Expand Down Expand Up @@ -1594,7 +1594,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`
* Return: {Integer}
* Returns: {Integer}

Reads an unsigned 32-bit integer from `buf` at the specified `offset` with
specified endian format (`readUInt32BE()` returns big endian,
Expand Down Expand Up @@ -1627,7 +1627,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`
* Return: {Integer}
* Returns: {Integer}

Reads `byteLength` number of bytes from `buf` at the specified `offset`
and interprets the result as an unsigned integer. Supports up to 48
Expand Down Expand Up @@ -1659,7 +1659,7 @@ added: v0.3.0
* `start` {Integer} Where the new `Buffer` will start. **Default:** `0`
* `end` {Integer} Where the new `Buffer` will end (not inclusive).
**Default:** [`buf.length`]
* Return: {Buffer}
* Returns: {Buffer}

Returns a new `Buffer` that references the same memory as the original, but
offset and cropped by the `start` and `end` indices.
Expand Down Expand Up @@ -1715,7 +1715,7 @@ console.log(buf.slice(-5, -2).toString());
added: v5.10.0
-->

* Return: {Buffer} A reference to `buf`
* Returns: {Buffer} A reference to `buf`

Interprets `buf` as an array of unsigned 16-bit integers and swaps the byte-order
*in-place*. Throws a `RangeError` if [`buf.length`] is not a multiple of 2.
Expand Down Expand Up @@ -1745,7 +1745,7 @@ buf2.swap32();
added: v5.10.0
-->

* Return: {Buffer} A reference to `buf`
* Returns: {Buffer} A reference to `buf`

Interprets `buf` as an array of unsigned 32-bit integers and swaps the byte-order
*in-place*. Throws a `RangeError` if [`buf.length`] is not a multiple of 4.
Expand Down Expand Up @@ -1775,7 +1775,7 @@ buf2.swap32();
added: v6.3.0
-->

* Return: {Buffer} A reference to `buf`
* Returns: {Buffer} A reference to `buf`

Interprets `buf` as an array of 64-bit numbers and swaps the byte-order *in-place*.
Throws a `RangeError` if [`buf.length`] is not a multiple of 8.
Expand Down Expand Up @@ -1812,7 +1812,7 @@ added: v0.1.90
* `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`]
* Return: {String}
* Returns: {String}

Decodes `buf` to a string according to the specified character encoding in
`encoding`. `start` and `end` may be passed to decode only a subset of `buf`.
Expand Down Expand Up @@ -1851,7 +1851,7 @@ console.log(buf2.toString(undefined, 0, 3));
added: v0.9.2
-->

* Return: {Object}
* Returns: {Object}

Returns a JSON representation of `buf`. [`JSON.stringify()`] implicitly calls
this function when stringifying a `Buffer` instance.
Expand Down Expand Up @@ -1880,7 +1880,7 @@ console.log(copy);
added: v1.1.0
-->

* Return: {Iterator}
* Returns: {Iterator}

Creates and returns an [iterator] for `buf` values (bytes). This function is
called automatically when a `Buffer` is used in a `for..of` statement.
Expand Down Expand Up @@ -1922,7 +1922,7 @@ added: v0.1.90
* `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'`
* Return: {Integer} Number of bytes written
* Returns: {Integer} Number of bytes written

Writes `string` to `buf` at `offset` according to the character encoding in `encoding`.
The `length` parameter is the number of bytes to write. If `buf` did not contain
Expand All @@ -1949,7 +1949,7 @@ added: v0.11.15
* `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`
* Return: {Integer} `offset` plus the number of bytes written
* Returns: {Integer} `offset` plus the number of bytes written

Writes `value` to `buf` at the specified `offset` with specified endian
format (`writeDoubleBE()` writes big endian, `writeDoubleLE()` writes little
Expand Down Expand Up @@ -1984,7 +1984,7 @@ added: v0.11.15
* `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`
* Return: {Integer} `offset` plus the number of bytes written
* Returns: {Integer} `offset` plus the number of bytes written

Writes `value` to `buf` at the specified `offset` with specified endian
format (`writeFloatBE()` writes big endian, `writeFloatLE()` writes little
Expand Down Expand Up @@ -2018,7 +2018,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`
* Return: {Integer} `offset` plus the number of bytes written
* Returns: {Integer} `offset` plus the number of bytes written

Writes `value` to `buf` at the specified `offset`. `value` *should* be a valid
signed 8-bit integer. Behavior is undefined when `value` is anything other than
Expand Down Expand Up @@ -2050,7 +2050,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`
* Return: {Integer} `offset` plus the number of bytes written
* Returns: {Integer} `offset` plus the number of bytes written

Writes `value` to `buf` at the specified `offset` with specified endian
format (`writeInt16BE()` writes big endian, `writeInt16LE()` writes little
Expand Down Expand Up @@ -2083,7 +2083,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`
* Return: {Integer} `offset` plus the number of bytes written
* Returns: {Integer} `offset` plus the number of bytes written

Writes `value` to `buf` at the specified `offset` with specified endian
format (`writeInt32BE()` writes big endian, `writeInt32LE()` writes little
Expand Down Expand Up @@ -2118,7 +2118,7 @@ added: v0.11.15
* `byteLength` {Integer} How many bytes to write. Must satisfy: `0 < byteLength <= 6`
* `noAssert` {Boolean} Skip `value`, `offset`, and `byteLength` validation?
**Default:** `false`
* Return: {Integer} `offset` plus the number of bytes written
* Returns: {Integer} `offset` plus the number of bytes written

Writes `byteLength` bytes of `value` to `buf` at the specified `offset`.
Supports up to 48 bits of accuracy. Behavior is undefined when `value` is
Expand Down Expand Up @@ -2151,7 +2151,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`
* Return: {Integer} `offset` plus the number of bytes written
* Returns: {Integer} `offset` plus the number of bytes written

Writes `value` to `buf` at the specified `offset`. `value` *should* be a
valid unsigned 8-bit integer. Behavior is undefined when `value` is anything
Expand Down Expand Up @@ -2183,7 +2183,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`
* Return: {Integer} `offset` plus the number of bytes written
* Returns: {Integer} `offset` plus the number of bytes written

Writes `value` to `buf` at the specified `offset` with specified endian
format (`writeUInt16BE()` writes big endian, `writeUInt16LE()` writes little
Expand Down Expand Up @@ -2220,7 +2220,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`
* Return: {Integer} `offset` plus the number of bytes written
* Returns: {Integer} `offset` plus the number of bytes written

Writes `value` to `buf` at the specified `offset` with specified endian
format (`writeUInt32BE()` writes big endian, `writeUInt32LE()` writes little
Expand Down Expand Up @@ -2257,7 +2257,7 @@ added: v0.5.5
* `byteLength` {Integer} How many bytes to write. Must satisfy: `0 < byteLength <= 6`
* `noAssert` {Boolean} Skip `value`, `offset`, and `byteLength` validation?
**Default:** `false`
* Return: {Integer} `offset` plus the number of bytes written
* Returns: {Integer} `offset` plus the number of bytes written

Writes `byteLength` bytes of `value` to `buf` at the specified `offset`.
Supports up to 48 bits of accuracy. Behavior is undefined when `value` is
Expand Down
Loading