Skip to content

tls: refactor variable declarations - #22219

Closed
oygen87 wants to merge 1 commit into
nodejs:masterfrom
oygen87:patch-1
Closed

tls: refactor variable declarations#22219
oygen87 wants to merge 1 commit into
nodejs:masterfrom
oygen87:patch-1

Conversation

@oygen87

Copy link
Copy Markdown
Contributor

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-botnodejs-github-bot added the tls Issues and PRs related to the tls subsystem. label Aug 9, 2018
@Trott

Trott commented Aug 9, 2018

Copy link
Copy Markdown
Member

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

@sagirksagirk left a comment

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.

LGTM! 🎉

@devsnekdevsnek changed the title refactortls: refactor variable declarationsAug 12, 2018
Comment threadlib/internal/tls.js
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

Landed in 74d3363

@jasnelljasnell closed this Aug 12, 2018
@rvaggrvagg mentioned this pull request Aug 13, 2018
rvagg pushed a commit that referenced this pull request Aug 13, 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>
firass111 pushed a commit to firass111/Project_node1 that referenced this pull request Apr 16, 2025
PR-URL: nodejs/node#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>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.tlsIssues and PRs related to the tls subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

11 participants

@oygen87@Trott@jasnell@addaleax@cjihrig@sagirk@maclover7@devsnek@aduh95@trivikr@nodejs-github-bot