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

tls: refactor variable declarations #22219

Closed
wants to merge 1 commit into from
Closed

tls: refactor variable declarations #22219

wants to merge 1 commit into from

Conversation

oygen87
Copy link
Contributor

@oygen87 oygen87 commented Aug 9, 2018

change var to const

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

change var to const
@nodejs-github-bot nodejs-github-bot added the tls Issues and PRs related to the tls subsystem. label Aug 9, 2018
@Trott
Copy link
Member

Trott commented Aug 9, 2018

@Trott Trott added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Aug 9, 2018
Copy link
Contributor

@sagirk sagirk left a comment

Choose a reason for hiding this comment

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

LGTM! 🎉

@devsnek devsnek changed the title refactor tls: refactor variable declarations Aug 12, 2018
var out = Object.create(null);
var parts = s.split('\n');
const out = Object.create(null);
const parts = s.split('\n');
for (var i = 0, len = parts.length; i < len; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we replace the for loop by a for-of loop?

Copy link
Member

Choose a reason for hiding this comment

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

Using the traditional for loop is still significantly faster than for-of and is fairly idiomatic still within Node.js core js.

jasnell pushed a commit that referenced this pull request Aug 12, 2018
PR-URL: #22219
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
@jasnell
Copy link
Member

jasnell commented Aug 12, 2018

Landed in 74d3363

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. tls Issues and PRs related to the tls subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet