Skip to content

Commit 67be41a

Browse files
TrottMyles Borins
authored and
Myles Borins
committed
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: #4853 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Roman Reiss <[email protected]>
1 parent 1878cd5 commit 67be41a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/_tls_common.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ exports.createSecureContext = function createSecureContext(options, context) {
4747
// cert's issuer in C++ code.
4848
if (options.ca) {
4949
if (Array.isArray(options.ca)) {
50-
for (var i = 0, len = options.ca.length; i < len; i++) {
50+
for (let i = 0, len = options.ca.length; i < len; i++) {
5151
c.context.addCACert(options.ca[i]);
5252
}
5353
} else {
@@ -59,7 +59,7 @@ exports.createSecureContext = function createSecureContext(options, context) {
5959

6060
if (options.cert) {
6161
if (Array.isArray(options.cert)) {
62-
for (var i = 0; i < options.cert.length; i++)
62+
for (let i = 0; i < options.cert.length; i++)
6363
c.context.setCert(options.cert[i]);
6464
} else {
6565
c.context.setCert(options.cert);
@@ -72,7 +72,7 @@ exports.createSecureContext = function createSecureContext(options, context) {
7272
// which leads to the crash later on.
7373
if (options.key) {
7474
if (Array.isArray(options.key)) {
75-
for (var i = 0; i < options.key.length; i++) {
75+
for (let i = 0; i < options.key.length; i++) {
7676
var key = options.key[i];
7777

7878
if (key.passphrase)
@@ -103,7 +103,7 @@ exports.createSecureContext = function createSecureContext(options, context) {
103103

104104
if (options.crl) {
105105
if (Array.isArray(options.crl)) {
106-
for (var i = 0, len = options.crl.length; i < len; i++) {
106+
for (let i = 0, len = options.crl.length; i < len; i++) {
107107
c.context.addCRL(options.crl[i]);
108108
}
109109
} else {

0 commit comments

Comments
 (0)