doc: format ArrayBufferView as inline code#17595
doc: format ArrayBufferView as inline code#17595tniessen wants to merge 2 commits intonodejs:masterfrom
Conversation
doc/api/crypto.md
Outdated
| - version: v9.0.0 | ||
| pr-url: https://github.com/nodejs/node/pull/15231 | ||
| description: The `buffer` argument may be any ArrayBufferView | ||
| description: The `buffer` argument may be any `ArrayBufferView` |
There was a problem hiding this comment.
I know I probably added this myself, but I now actually prefer ArrayBufferView to not be mentioned at all in the documentation, as it's not a JavaScript type (only a Web IDL one). I'd say something like "may be any TypedArray or DataView".
doc/api/crypto.md
Outdated
| description: The `buffer` argument may be any `ArrayBufferView` | ||
| --> | ||
|
|
||
| * `buffer` {Buffer|Uint8Array|ArrayBufferView} Must be supplied. |
There was a problem hiding this comment.
While at it, Uint8Array is now redundant. Ditto below.
There was a problem hiding this comment.
So is Buffer. ;) The thing is, at this point most Node developers don’t know that Buffer is a kind of Uint8Array, so it makes sense to list them both. In the same vein, keeping ArrayBufferView listed explicitly might be redundant but helpful, since 99 % of the time the user is going to pass in an Uint8Array.
There was a problem hiding this comment.
But if it is fairly obvious that Uint8Array is a type of TypedArray. In conjunction with #17595 (comment), my preference would be {Buffer|TypedArray|DataView}.
|
@TimothyGu @addaleax PTAL |
|
Landed in def6072. |
PR-URL: #17595 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: #17595 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
ArrayBufferView should be formatted as
ArrayBufferView.Checklist
Affected core subsystem(s)
doc