-
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,tool: refactor checking jsPrimitives #8740
Conversation
Manually added |
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.
LGTM
if (jsPrimitives.indexOf(typeText) !== -1) { | ||
typeUrl = jsPrimitiveUrl + '#' + typeText + '_type'; | ||
const primitive = jsPrimitives[typeText]; | ||
if (primitive !== undefined) { |
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.
Any reason for explicitly checking for !== undefined
? Isn't if (primitive)
sufficient?
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.
Checking with undefined
might be more precise and meaningful here, because here we are checking if this primitive type by the typeText
is undefined, this is actually my original thoughts.
Both looks good to me, so @lpinca if you have an objection about undefined, I will change to follow you :)
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.
No objection, I just find it easier to read without the undefined
check but either way LGTM.
I’m not sure if this needs a full CI, but here it is: https://ci.nodejs.org/job/node-test-commit/5266/ |
typeUrl = jsPrimitiveUrl + '#' + typeText + '_type'; | ||
const primitive = jsPrimitives[typeText]; | ||
if (primitive !== undefined) { | ||
typeUrl = jsPrimitiveUrl + '#' + primitive + '_type'; |
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 wonder if it's better to use a template literal here.
Done with template string @lpinca Thank you |
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.
LGTM
We documented most types as Integer, but we don't have link for that. PR-URL: nodejs#8740 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
73a1496
to
ee417c5
Compare
We documented most types as Integer, but we don't have link for that. PR-URL: #8740 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Landed at eaa0806 because the CI failure seems not related, correct me if I'm wrong :) |
We documented most types as Integer, but we don't have link for that. PR-URL: #8740 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
We documented most types as Integer, but we don't have link for that. PR-URL: nodejs#8740 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
We documented most types as Integer, but we don't have link for that. PR-URL: #8740 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Checklist
Affected core subsystem(s)
doc, tool
Description of change
There are most types like
Integer
andTypedArray
in our documentations, but we don't have a good reference to them like others, so fix them in our doctool, but I'm not sure if we should mapInteger
as aNumber
type, actually even theInteger
is not a real type in v8, by the way, theInt32
might be more proper as v8 has the typeInt32Array
:)