-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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: Use .prototype. for consistency #38032
Conversation
-1 I believe the reason for the Changing the |
I mean, it doesn't make much difference really, I don't see anyone thinking that |
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 |
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 read -
TypedArray#slice()
- to leave it as the shorter#
notation
The dots are very much incorrect. Either |
I think it would be better to show the instance properties/methods by adding |
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.
Thanks for the speedy correction! We just need one more approval and we can get this landed.
Thanks!
@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). |
👍 Done (Sometimes I hate linters lol) |
I'd much rather opt for the |
The thing is, using |
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 wish #
notation had caught up more, but I agree it's the right call to use .prototype.
:
- in Node.js documentation,
buffer.md
is 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. prototype
has 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>
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.