Skip to content

Commit

Permalink
tls: scope loop vars with let
Browse files Browse the repository at this point in the history
`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 <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
  • Loading branch information
Trott authored and silverwind committed Jan 26, 2016
1 parent 2c42635 commit 6a73dba
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/_tls_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ exports.createSecureContext = function createSecureContext(options, context) {
// cert's issuer in C++ code.
if (options.ca) {
if (Array.isArray(options.ca)) {
for (var i = 0, len = options.ca.length; i < len; i++) {
for (let i = 0, len = options.ca.length; i < len; i++) {
c.context.addCACert(options.ca[i]);
}
} else {
Expand All @@ -60,7 +60,7 @@ exports.createSecureContext = function createSecureContext(options, context) {

if (options.cert) {
if (Array.isArray(options.cert)) {
for (var i = 0; i < options.cert.length; i++)
for (let i = 0; i < options.cert.length; i++)
c.context.setCert(options.cert[i]);
} else {
c.context.setCert(options.cert);
Expand All @@ -73,7 +73,7 @@ exports.createSecureContext = function createSecureContext(options, context) {
// which leads to the crash later on.
if (options.key) {
if (Array.isArray(options.key)) {
for (var i = 0; i < options.key.length; i++) {
for (let i = 0; i < options.key.length; i++) {
var key = options.key[i];

if (key.passphrase)
Expand Down Expand Up @@ -108,7 +108,7 @@ exports.createSecureContext = function createSecureContext(options, context) {

if (options.crl) {
if (Array.isArray(options.crl)) {
for (var i = 0, len = options.crl.length; i < len; i++) {
for (let i = 0, len = options.crl.length; i < len; i++) {
c.context.addCRL(options.crl[i]);
}
} else {
Expand Down

0 comments on commit 6a73dba

Please sign in to comment.