Skip to content

Commit 6a73dba

Browse files
Trottsilverwind
authored andcommitted
tls: scope loop vars with let
`lib/_tls_common.js` had instances of `for` loops that defined variables with `var` such that they were re-declared in the same scope. This change scopes those variables with `let` so that they are not re-declared. PR-URL: nodejs#4853 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
1 parent 2c42635 commit 6a73dba

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/_tls_common.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ exports.createSecureContext = function createSecureContext(options, context) {
4848
// cert's issuer in C++ code.
4949
if (options.ca) {
5050
if (Array.isArray(options.ca)) {
51-
for (var i = 0, len = options.ca.length; i < len; i++) {
51+
for (let i = 0, len = options.ca.length; i < len; i++) {
5252
c.context.addCACert(options.ca[i]);
5353
}
5454
} else {
@@ -60,7 +60,7 @@ exports.createSecureContext = function createSecureContext(options, context) {
6060

6161
if (options.cert) {
6262
if (Array.isArray(options.cert)) {
63-
for (var i = 0; i < options.cert.length; i++)
63+
for (let i = 0; i < options.cert.length; i++)
6464
c.context.setCert(options.cert[i]);
6565
} else {
6666
c.context.setCert(options.cert);
@@ -73,7 +73,7 @@ exports.createSecureContext = function createSecureContext(options, context) {
7373
// which leads to the crash later on.
7474
if (options.key) {
7575
if (Array.isArray(options.key)) {
76-
for (var i = 0; i < options.key.length; i++) {
76+
for (let i = 0; i < options.key.length; i++) {
7777
var key = options.key[i];
7878

7979
if (key.passphrase)
@@ -108,7 +108,7 @@ exports.createSecureContext = function createSecureContext(options, context) {
108108

109109
if (options.crl) {
110110
if (Array.isArray(options.crl)) {
111-
for (var i = 0, len = options.crl.length; i < len; i++) {
111+
for (let i = 0, len = options.crl.length; i < len; i++) {
112112
c.context.addCRL(options.crl[i]);
113113
}
114114
} else {

0 commit comments

Comments
 (0)