-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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.lastIndexOf #4933
Conversation
Can you order this alphabetically like the rest? |
b80c2dc
to
a31e635
Compare
@tflanagan fixed |
@dcposch, thanks :) |
Also, it'd be good to expand the parameter bits to be in-line with this other buffers PR: #4873 |
@Qard fixed |
Identical to [`Buffer#indexOf()`][], but searches the Buffer from back to front | ||
instead of front to back. Returns the starting index position of `value` in | ||
Buffer or `-1` if the Buffer does not contain `value`. The `value` can be a | ||
String, Buffer or Number. Strings are by default interpreted as UTF8. If |
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.
UTF**-**8
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.
Also you should need to mention the default encoding at all since it is listed above.
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.
It's rendered "UTF8" everywhere else in this file. I think this is fine.
5d3105a
to
82733a2
Compare
@Qard looks more dece now? |
@@ -577,6 +577,46 @@ for (var key of buf.keys()) { | |||
// 5 | |||
``` | |||
|
|||
### buf.lastIndexOf(value[, byteOffset][, encoding]) | |||
|
|||
* `value` {String, Buffer or Number} |
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.
Can you wrap each type separately, please?
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.
It's done like this everywhere else in the file -- eg indexOf
, includes
, and fill
I can change all of those places if you want--LMK
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.
@Qard added a commit that wraps types separately everywhere there's a list
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.
Unfortunately wrapping the three separately confuses the JSON documentation generation IIRC.
LGTM |
`byteOffset`. | ||
|
||
```js | ||
const buf = new Buffer('this buffer is a buffer'); |
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.
Could you please add
const Buffer = require('buffer').Buffer;
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.
Is it needed for the linter ? Buffer
is global.
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.
The linter does complain about it
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.
@tflanagan no other code sample in this doc does that
which linter are you talking about? make test
and make doc
both run without errors
@jasnell thanks for the review. i just rebased because there were conflicts. the PR is even smaller now -- it only adds the |
LGTM |
how does this relate to #4846? |
That's what I figured... any reason not to simply bundle the two commits into the single PR #4846? Would make it easier to land. |
Agreed, it's better that docs commits of new features are included in the PR of the feature itself and just mention @nodejs/documentation in the issue to summon us docs folks for review. |
Complements #4604
Together they fix #4846