From 8cb6b5d2a10979684846df11f4d6e937aae105ba Mon Sep 17 00:00:00 2001 From: Voltrex <62040526+VoltrexMaster@users.noreply.github.com> Date: Fri, 2 Apr 2021 04:25:38 +0430 Subject: [PATCH] doc: use `foo.prototype.bar` notation in buffer.md Most of the documentation uses `foo.prototype.bar` notation instead of `foo#bar` notation, this commit apply the former in `buffer.md`. PR-URL: https://github.com/nodejs/node/pull/38032 Reviewed-By: Derek Lewis Reviewed-By: Antoine du Hamel Reviewed-By: Colin Ihrig Reviewed-By: Darshan Sen --- doc/api/buffer.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 7e75e33a270a52..6e601dbf470278 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -176,12 +176,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. @@ -1086,9 +1086,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. @@ -1349,7 +1349,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'); @@ -1449,7 +1449,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'); @@ -2136,7 +2136,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. @@ -3574,13 +3574,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