-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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: clarify the parameter byteOffset for lastIndexOf method of Buffer #38167
Conversation
/cc @Trott |
I find the proposed wording harder to understand, but maybe that's just me. Do others think it is either more precise or easier to read? @nodejs/documentation |
* `byteOffset` {integer} The index of the last byte in `buf` to be considered | ||
as the beginning of a match. If negative, then offset is calculated |
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.
* `byteOffset` {integer} The index of the last byte in `buf` to be considered | |
as the beginning of a match. If negative, then offset is calculated | |
* `byteOffset` {integer} The last zero-based index (in bytes) of `buf` to be | |
considered as the beginning of a match. If negative, then offset is calculated |
My 2¢, but given that Buffer
is a subclass of Uint8Array
, we may be able to use some of the language used by MDN if it's more suitable.
The
Buffer
class is a subclass of JavaScript'sUint8Array
class and extends it with methods that cover additional use cases.
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 find the proposed wording harder to understand, but maybe that's just me. Do others think it is either more precise or easier to read? @nodejs/documentation
I was inspired by the documentation concerning the lastIndexOf
method of string (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf)) but we can also draw inspiration from the documentation of TypedArray (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/lastIndexOf) as suggested by @DerekNonGeneric
This would need a rebase if we still want to land it. |
This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open. |
Closing this because it has stalled. Feel free to reopen if this issue/PR is still relevant, or to ping the collaborator who labelled it stalled if you have any questions. |
I suggest to clarify the parameter
byteOffset
for thelastIndexOf
method ofBuffer
.Currently, the doc says :
"Where to begin searching in buf"
But in my opinion, it's not just. The parameter is more :
"the index of the last byte in buf to be considered as the beginning of a match."
What do you think about that ?