Skip to content

Commit

Permalink
doc: use foo.prototype.bar notation in buffer.md
Browse files Browse the repository at this point in the history
Most of the documentation uses `foo.prototype.bar` notation instead of
`foo#bar` notation, this commit apply the former in `buffer.md`.

PR-URL: #38032
Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
  • Loading branch information
VoltrexKeyva authored and targos committed Jun 11, 2021
1 parent c77abf5 commit e994d6a
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,12 @@ however, subtle incompatibilities between the `Buffer` API and the

In particular:

* While [`TypedArray#slice()`][] creates a copy of part of the `TypedArray`,
[`Buffer#slice()`][`buf.slice()`] creates a view over the existing `Buffer`
* While [`TypedArray.prototype.slice()`][] creates a copy of part of the `TypedArray`,
[`Buffer.prototype.slice()`][`buf.slice()`] creates a view over the existing `Buffer`
without copying. This behavior can be surprising, and only exists for legacy
compatibility. [`TypedArray#subarray()`][] can be used to achieve the behavior
of [`Buffer#slice()`][`buf.slice()`] on both `Buffer`s and other
`TypedArray`s.
compatibility. [`TypedArray.prototype.subarray()`][] can be used to achieve
the behavior of [`Buffer.prototype.slice()`][`buf.slice()`] on both `Buffer`s
and other `TypedArray`s.
* [`buf.toString()`][] is incompatible with its `TypedArray` equivalent.
* A number of methods, e.g. [`buf.indexOf()`][], support additional arguments.

Expand Down Expand Up @@ -947,9 +947,9 @@ added: v0.1.90
Copies data from a region of `buf` to a region in `target`, even if the `target`
memory region overlaps with `buf`.

[`TypedArray#set()`][] performs the same operation, and is available for all
TypedArrays, including Node.js `Buffer`s, although it takes different
function arguments.
[`TypedArray.prototype.set()`][] performs the same operation, and is available
for all TypedArrays, including Node.js `Buffer`s, although it takes
different function arguments.

```js
// Create two `Buffer` instances.
Expand Down Expand Up @@ -1210,7 +1210,7 @@ an integer between 0 and 255.

If `byteOffset` is not a number, it will be coerced to a number. If the result
of coercion is `NaN` or `0`, then the entire buffer will be searched. This
behavior matches [`String#indexOf()`][].
behavior matches [`String.prototype.indexOf()`][].

```js
const b = Buffer.from('abcdef');
Expand Down Expand Up @@ -1310,7 +1310,7 @@ an integer between 0 and 255.

If `byteOffset` is not a number, it will be coerced to a number. Any arguments
that coerce to `NaN`, like `{}` or `undefined`, will search the whole buffer.
This behavior matches [`String#lastIndexOf()`][].
This behavior matches [`String.prototype.lastIndexOf()`][].

```js
const b = Buffer.from('abcdef');
Expand Down Expand Up @@ -1981,7 +1981,7 @@ offset and cropped by the `start` and `end` indices.
Specifying `end` greater than [`buf.length`][] will return the same result as
that of `end` equal to [`buf.length`][].

This method is inherited from [`TypedArray#subarray()`][].
This method is inherited from [`TypedArray.prototype.subarray()`][].

Modifying the new `Buffer` slice will modify the memory in the original `Buffer`
because the allocated memory of the two objects overlap.
Expand Down Expand Up @@ -3396,13 +3396,13 @@ introducing security vulnerabilities into an application.
[`ERR_OUT_OF_RANGE`]: errors.md#ERR_OUT_OF_RANGE
[`JSON.stringify()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
[`SharedArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer
[`String#indexOf()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf
[`String#lastIndexOf()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf
[`String.prototype.indexOf()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf
[`String.prototype.lastIndexOf()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf
[`String.prototype.length`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length
[`TypedArray#set()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set
[`TypedArray#slice()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/slice
[`TypedArray#subarray()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray
[`TypedArray.from()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from
[`TypedArray.prototype.set()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set
[`TypedArray.prototype.slice()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/slice
[`TypedArray.prototype.subarray()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray
[`TypedArray`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
[`Uint8Array`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array
[`buf.buffer`]: #buffer_buf_buffer
Expand Down

0 comments on commit e994d6a

Please sign in to comment.