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: format ArrayBufferView as inline code #17595

Closed
Closed
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions doc/api/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Copy link
Member

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".

-->

* `buffer` {Buffer|Uint8Array|ArrayBufferView} Must be supplied.
Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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}.

Expand Down Expand Up @@ -1889,7 +1889,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.
Expand Down