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: fix missing Buffer.of method in docs/buffer #21439

Closed
wants to merge 1 commit into from
Closed

doc: fix missing Buffer.of method in docs/buffer #21439

wants to merge 1 commit into from

Conversation

ZaneHannanAU
Copy link
Contributor

Note: Part added needs verification; however
is commented out in case it cannot be verified
or is otherwise deemed unnecessary for users.

Checklist

Note: Part added needs verification; however
is commented out in case it cannot be verified
or is otherwise deemed unnecessary for users.
@nodejs-github-bot nodejs-github-bot added buffer Issues and PRs related to the buffer subsystem. doc Issues and PRs related to the documentations. labels Jun 21, 2018
@mscdex
Copy link
Contributor

mscdex commented Jun 21, 2018

I'm not sure we need to document methods inherited from Uint8Array.

added: 6.0.0
-->

* `...items` {number[]} A list of values for buffer initialisation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{integer}

initialization (we use US spelling)

added: 6.0.0
-->

* `...items` {number[]} A list of values for buffer initialisation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{integer}

several internal setup calls.

```js
Buffer.from(1, 2, 3, 4).equals(Buffer.from([1, 2, 3, 4]))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first call should be Buffer.of(). End the line with a semicolon. Also, it would be helpful to have the return value of .equals() as a comment.

several internal setup calls.

```js
Buffer.from(1, 2, 3, 4).equals(Buffer.from([1, 2, 3, 4]))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first call should be Buffer.of(). End the line with a semicolon. Also, it would be helpful to have the return value of .equals() as a comment.

using the deprecated `Buffer()` constructor. <!--Additionally,
`Buffer.of` may be more performant as it creates and
fills the Buffer directly, and does not create a `this`
reference as it uses arrow syntax. -->
Copy link
Member

@TimothyGu TimothyGu Jun 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to mention "avoids using the constructor," an implementation detail.

I'd specifically mention Uint8Array.of rather than the generic %TypedArray%.of.

I'd like to see some evidence that Buffer.of is more efficient than Buffer.from – if that's true then I would uncomment the additional info, and if not or unable to be verified then the comment should be deleted. Either way there should be no comment.

There's also no need to mention this reference or arrow syntax, which is an implementation detail.

@TimothyGu
Copy link
Member

TimothyGu commented Jun 21, 2018

@mscdex It's no longer inherited from %TypedArray% after #19682.

@ZaneHannanAU Please also take a look at the Travis CI failure.

@mscdex
Copy link
Contributor

mscdex commented Jun 21, 2018

@TimothyGu I meant inherited in any sense. The behavior of our implementation should match that of Uint8Array, no? If so, why document it? I don't see why we should expose this implementation detail.

@vsemozhetbyt
Copy link
Contributor

What is the status of this PR? Would it proceed?

@ZaneHannanAU
Copy link
Contributor Author

@vsemozhetbyt unlikely. The main reason for is that the function does not inherit from its parent; the main against is that the function does follow the same rules as its parent.

@vsemozhetbyt
Copy link
Contributor

Thank you. So can we close it for now? We can always reconsider later.

@ZaneHannanAU
Copy link
Contributor Author

I am fine with closing it; I just want a formal yes/no; at least once I've fixed it now I remember it… anyway; once I fix it up and the build passes if it's not worth the time let's leave it be. For now I'll close it though.

@vsemozhetbyt
Copy link
Contributor

To be on the safe side, cc @nodejs/buffer

@Trott
Copy link
Member

Trott commented Aug 17, 2018

I'm going to close this as the branch has apparently been deleted so I can't even update the branch. Re-open or leave a comment if it should be left open. If anyone else wants to document Buffer.of(), by all means, open a PR. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
buffer Issues and PRs related to the buffer subsystem. doc Issues and PRs related to the documentations.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants