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

lib/tls: replace var with let/const #30409

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/tls.js
Expand Up @@ -109,8 +109,8 @@ function convertProtocols(protocols) {
return p + 1 + len;
}, 0));

var offset = 0;
for (var i = 0, c = protocols.length; i < c; i++) {
let offset = 0;
for (let i = 0, c = protocols.length; i < c; i++) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: offset can be moved inside loop as follows:

Suggested change
for (let i = 0, c = protocols.length; i < c; i++) {
for (let offset = 0, i = 0, c = protocols.length; i < c; i++) {

buff[offset++] = lens[i];
buff.write(protocols[i], offset);
offset += lens[i];
Expand Down Expand Up @@ -163,7 +163,7 @@ function check(hostParts, pattern, wildcards) {
return false;

// Check host parts from right to left first.
for (var i = hostParts.length - 1; i > 0; i -= 1) {
for (let i = hostParts.length - 1; i > 0; i -= 1) {
if (hostParts[i] !== patternParts[i])
return false;
}
Expand Down