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,tool: refactor checking jsPrimitives #8740

Closed
wants to merge 1 commit into from

Conversation

yorkie
Copy link
Contributor

@yorkie yorkie commented Sep 23, 2016

Checklist
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

doc, tool

Description of change

There are most types like Integer and TypedArray 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 map Integer as a Number type, actually even the Integer is not a real type in v8, by the way, the Int32 might be more proper as v8 has the type Int32Array :)

@nodejs-github-bot nodejs-github-bot added the tools Issues and PRs related to the tools directory. label Sep 23, 2016
@yorkie yorkie added the doc Issues and PRs related to the documentations. label Sep 23, 2016
@yorkie
Copy link
Contributor Author

yorkie commented Sep 23, 2016

Manually added doc label because actually this is deeply relevant with the doc module.

Copy link
Member

@addaleax addaleax left a 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) {
Copy link
Member

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?

Copy link
Contributor Author

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 :)

Copy link
Member

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.

@addaleax
Copy link
Member

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';
Copy link
Member

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.

@yorkie
Copy link
Contributor Author

yorkie commented Sep 23, 2016

Done with template string @lpinca Thank you

Copy link
Member

@lpinca lpinca left a 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>
yorkie added a commit that referenced this pull request Sep 26, 2016
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>
@yorkie
Copy link
Contributor Author

yorkie commented Sep 26, 2016

Landed at eaa0806 because the CI failure seems not related, correct me if I'm wrong :)

@yorkie yorkie closed this Sep 26, 2016
@yorkie yorkie deleted the improve/docs branch September 26, 2016 14:28
jasnell pushed a commit that referenced this pull request Sep 29, 2016
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>
geek pushed a commit to geek/node that referenced this pull request Sep 30, 2016
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>
Fishrock123 pushed a commit that referenced this pull request Oct 11, 2016
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. tools Issues and PRs related to the tools directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants