FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

doc: modernize code examples in the cluster.md by vsemozhetbyt · Pull Request #10270 · nodejs/node · GitHub

/ node Public

doc: modernize code examples in the cluster.md - #10270

Closed
vsemozhetbyt wants to merge 7 commits into
nodejs:masterfrom
vsemozhetbyt:cluster.md
Closed

doc: modernize code examples in the cluster.md#10270
vsemozhetbyt wants to merge 7 commits into
nodejs:masterfrom
vsemozhetbyt:cluster.md

Conversation

vsemozhetbyt commented Dec 14, 2016
edited
Loading

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

doc, cluster

Description of change
  1. var -> let / const
  2. concatenate -> template literal
  3. == -> ===
  4. anonymous function -> arrow function
  5. update an obsolete example (see the comment in the issue)
  6. simplify cluster.workers iteration: Object.keys().forEach -> for...in

Fixes: #10255

nodejs-github-bot added cluster Issues and PRs related to the cluster subsystem. doc Issues and PRs related to the documentations. lts-watch-v6.x labels Dec 14, 2016
Comment thread doc/api/cluster.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Can you use "started"? There is an online event, and this isn't it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Done.

Comment thread doc/api/cluster.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

this is worse than original

vsemozhetbyt Dec 15, 2016
edited
Loading

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@sam-github Should I also change the prototype into the for...in variant?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

sure

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@sam-github Done.

`cluster.workers` iteration: `Object.keys().forEach` -> `for`...`in`

Copy link
Copy Markdown
Contributor

LGTM, should be squashed before landing.

Comment thread doc/api/cluster.md
}

Object.keys(cluster.workers).forEach((id) => {
for (const id in cluster.workers) {

lpinca Dec 15, 2016
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Nit: I think it's better to keep Object.keys here? for...in also includes non own enumerable properties.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Nvm for...in is also used below.

sam-github Dec 15, 2016
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

There are no such properties in cluster.workers.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Yes I know, but I think the intention is to also educate in examples?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Yes, this example educates that there are no such properties, that cluster.workers is a vanilla js object underived from anything, and doesn't require complex boiler plate safe-guards to be used.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Fair enough :)

Copy link
Copy Markdown
Contributor Author

ping @nodejs/documentation

Copy link
Copy Markdown
Contributor

Landed in e03ee71

julianduque pushed a commit that referenced this pull request Dec 22, 2016
- Fixes #10255
- It also will be consistent with a previous code example.
- `cluster.workers` iteration: `Object.keys().forEach` -> `for`...`in`

PR-URL: #10270
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
vsemozhetbyt deleted the cluster.md branch December 22, 2016 18:01
evanlucas pushed a commit that referenced this pull request Jan 3, 2017
- Fixes #10255
- It also will be consistent with a previous code example.
- `cluster.workers` iteration: `Object.keys().forEach` -> `for`...`in`

PR-URL: #10270
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
evanlucas pushed a commit that referenced this pull request Jan 4, 2017
- Fixes #10255
- It also will be consistent with a previous code example.
- `cluster.workers` iteration: `Object.keys().forEach` -> `for`...`in`

PR-URL: #10270
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
MylesBorins pushed a commit that referenced this pull request Jan 23, 2017
- Fixes #10255
- It also will be consistent with a previous code example.
- `cluster.workers` iteration: `Object.keys().forEach` -> `for`...`in`

PR-URL: #10270
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
MylesBorins pushed a commit that referenced this pull request Jan 24, 2017
- Fixes #10255
- It also will be consistent with a previous code example.
- `cluster.workers` iteration: `Object.keys().forEach` -> `for`...`in`

PR-URL: #10270
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
MylesBorins mentioned this pull request Jan 24, 2017
MylesBorins pushed a commit that referenced this pull request Jan 31, 2017
- Fixes #10255
- It also will be consistent with a previous code example.
- `cluster.workers` iteration: `Object.keys().forEach` -> `for`...`in`

PR-URL: #10270
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cluster Issues and PRs related to the cluster subsystem. doc Issues and PRs related to the documentations.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL