-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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: add Buffer#subarray() and add note about Uint8Array#slice() #28101
Conversation
I don't think we need to document inherited methods like If anything, only the new note should be added to the description for |
Really? There are lots of methods and properties in the doc, directly inherited from
I think |
Right, I don't agree those need to be there either. IMO there is no need to duplicate documentation (already available at places like MDN) for those properties/methods unless there is some behavioral/semantic difference with node's implementation. Making it clear that Even within node's own documentation we generally don't duplicate between similar/super objects (e.g. |
#28101 (comment) makes sense to me. I wonder, do our docs predate Buffer being derived from Uint8Array? |
Definitely. |
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 think it’s a good change, because it ultimately encourages using a standardized TypedArray method over our non-standard different-behaviour override of another TypedArray method.
Co-Authored-By: Anna Henningsen <github@addaleax.net>
Co-Authored-By: Anna Henningsen <github@addaleax.net>
Applied suggested changes! |
I’ll land this tomorrow if there are no objections to that. |
Co-Authored-By: Rich Trott <rtrott@gmail.com>
Co-Authored-By: Rich Trott <rtrott@gmail.com>
Co-Authored-By: Rich Trott <rtrott@gmail.com>
Thanks, @Trott ! |
Landed in ee16787 |
PR-URL: nodejs#28101 Refs: nodejs#28087 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
refs: #28087
Buffer#subarray()
; its content is just copied from#slice()
Buffer#slice()
because of its incompatibility with its superclass's method, and also added how to useUint8Array.prototype.slice()
to get a copy of sliceChecklist
[ ]make -j4 test
(UNIX), orvcbuild test
(Windows) passes[ ] tests and/or benchmarks are included