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: add Buffer.lastIndexOf #4933

Closed
wants to merge 1 commit into from
Closed

doc: add Buffer.lastIndexOf #4933

wants to merge 1 commit into from

Conversation

dcposch
Copy link
Contributor

@dcposch dcposch commented Jan 28, 2016

Complements #4604

Together they fix #4846

@tflanagan
Copy link
Contributor

Can you order this alphabetically like the rest?

@r-52 r-52 added buffer Issues and PRs related to the buffer subsystem. doc Issues and PRs related to the documentations. labels Jan 28, 2016
@dcposch dcposch force-pushed the doc branch 3 times, most recently from b80c2dc to a31e635 Compare January 28, 2016 21:23
@dcposch
Copy link
Contributor Author

dcposch commented Jan 28, 2016

@tflanagan fixed

@tflanagan
Copy link
Contributor

@dcposch, thanks :)

@Qard
Copy link
Member

Qard commented Jan 28, 2016

Also, it'd be good to expand the parameter bits to be in-line with this other buffers PR: #4873

@dcposch
Copy link
Contributor Author

dcposch commented Jan 28, 2016

@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
Copy link
Member

Choose a reason for hiding this comment

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

UTF**-**8

Copy link
Member

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.

Copy link
Contributor Author

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.

@dcposch dcposch force-pushed the doc branch 2 times, most recently from 5d3105a to 82733a2 Compare February 1, 2016 02:52
@dcposch
Copy link
Contributor Author

dcposch commented Feb 1, 2016

@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}
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

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

Copy link
Member

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.

@jasnell
Copy link
Member

jasnell commented Feb 1, 2016

LGTM

@dcposch
Copy link
Contributor Author

dcposch commented Feb 2, 2016

@jasnell thanks for taking a look! Someone else will have to merge it for me, ideally at the same time as #4846 once that is ready.

@dcposch dcposch changed the title Add docs for Buffer.lastIndexOf doc: add Buffer.lastIndexOf Feb 4, 2016
`byteOffset`.

```js
const buf = new Buffer('this buffer is a buffer');
Copy link
Contributor

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;

Copy link
Member

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.

Copy link
Contributor

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

Copy link
Contributor Author

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

@dcposch
Copy link
Contributor Author

dcposch commented Feb 19, 2016

@jasnell thanks for the review.

i just rebased because there were conflicts. the PR is even smaller now -- it only adds the Buffer.lastIndexOf section to the docs and doesn't modify any existing sections

@dcposch
Copy link
Contributor Author

dcposch commented Mar 2, 2016

@jasnell @Qard let me know if the docs look good now.

I think the code part ( #4846 ) is ready to go.

@jasnell
Copy link
Member

jasnell commented Mar 2, 2016

LGTM

@jasnell
Copy link
Member

jasnell commented Mar 2, 2016

how does this relate to #4846?

@dcposch
Copy link
Contributor Author

dcposch commented Mar 3, 2016

@jasnell #4646 adds a new feature. This PR adds the corresponding docs.

@jasnell
Copy link
Member

jasnell commented Mar 3, 2016

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.

@Qard
Copy link
Member

Qard commented Mar 3, 2016

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.

@dcposch
Copy link
Contributor Author

dcposch commented Mar 4, 2016

@Qard done. Moved to #4846

@dcposch dcposch closed this Mar 4, 2016
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.

8 participants