-
Notifications
You must be signed in to change notification settings - Fork 30k
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: format ArrayBufferView as inline code #17595
Conversation
doc/api/crypto.md
Outdated
@@ -1847,7 +1847,7 @@ added: v7.10.0 | |||
changes: | |||
- 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -1847,7 +1847,7 @@ added: v7.10.0 | |||
changes: | |||
- 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` | |||
--> | |||
|
|||
* `buffer` {Buffer|Uint8Array|ArrayBufferView} Must be supplied. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While at it, Uint8Array
is now redundant. Ditto below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Landed in def6072. |
PR-URL: #17595 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: #17595 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
ArrayBufferView should be formatted as
ArrayBufferView
.Checklist
Affected core subsystem(s)
doc