Uh oh!
There was an error while loading. Please reload this page.
doc: Use .prototype. for consistency - #38032
Conversation
-1 I believe the reason for the Changing the |
VoltrexKeyva
commented
Apr 2, 2021
I mean, it doesn't make much difference really, I don't see anyone thinking that |
DerekNonGeneric
commented
Apr 2, 2021
I have never seen the hash notation to refer to instance methods, so it looked like a typo for me. I wonder if we have been consistent about doing this throughout all of our docs, though (doubtful). Using /cc @nodejs/documentation for more info, please |
VoltrexKeyva
commented
Apr 2, 2021
I went through almost all of the documentation markdown files ( |
I just happened to come across the notation again in the @typescript-eslint/prefer-regexp-exec docs and can confirm that it is definitely not a typo, but an established pattern (altho I have no idea what it is called).
This suggestion expands to suggesting to use It would be nice to know what this notation is called, so we can determine exactly how to use if we do end up using it. |
There was a problem hiding this comment.
Alright, after a bit of research, it has become clear to me that this change would be illogical since these are not static methods of these classes.
We would need one of the following changes to make it right:
typedArray.slice()- to make it look like an instance since they're not static (not a fan of this)TypedArray.prototype.slice()- to make entirely less confusing, but a little more to readTypedArray#slice()- to leave it as the shorter#notation
ljharb
commented
Apr 9, 2021
The dots are very much incorrect. Either |
VoltrexKeyva
commented
Apr 9, 2021
I think it would be better to show the instance properties/methods by adding |
DerekNonGeneric
left a comment
There was a problem hiding this comment.
Thanks for the speedy correction! We just need one more approval and we can get this landed.
Thanks!
DerekNonGeneric
commented
Apr 9, 2021
@VoltrexMaster, if you would be able to ensure that the line length does not exceed 80 characters now, it could improve the odds of getting more approvals with a green CI (Markdown linter is complaining). |
VoltrexKeyva
commented
Apr 9, 2021
👍 Done (Sometimes I hate linters lol) |
mscdex
commented
Apr 10, 2021
I'd much rather opt for the |
The thing is, using |
There was a problem hiding this comment.
I wish # notation had caught up more, but I agree it's the right call to use .prototype.:
- in Node.js documentation,
buffer.mdis the only place where this notation is currently being used. I'm rooting for consistency. - MDN uses
.prototype.notation, I think it makes sense to align with them. prototypehas a meaning for a reader proficient with ECMAScript, the#notation may seem out-of-place.
IMHO typedArray.slice() would not work here, the text is dealing with the effects of slice methods on a Buffer instance – which is also a TypedArray.
Most of the documentation uses `foo.prototype.bar` notation instead of `foo#bar` notation, this commit apply the former in `buffer.md`. PR-URL: nodejs#38032 Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
aduh95
commented
Apr 21, 2021
Landed in 8cb6b5d |
Most of the documentation uses `foo.prototype.bar` notation instead of `foo#bar` notation, this commit apply the former in `buffer.md`. PR-URL: #38032 Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
Most of the documentation uses `foo.prototype.bar` notation instead of `foo#bar` notation, this commit apply the former in `buffer.md`. PR-URL: #38032 Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
Most of the documentation uses `foo.prototype.bar` notation instead of `foo#bar` notation, this commit apply the former in `buffer.md`. PR-URL: #38032 Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
Most of the documentation uses `foo.prototype.bar` notation instead of `foo#bar` notation, this commit apply the former in `buffer.md`. PR-URL: #38032 Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
Most of the documentation uses the property accessor (
.) or.prototype.instead of#to point out some methods or properties (e.g.Buffer.alloc()), there's some that uses (Buffer#alloc()), this is a small change but just for the sake of consistency.