@@ -100,15 +100,12 @@ exports.createSecureContext = function createSecureContext(options) {
100
100
101
101
const c = new SecureContext ( options . secureProtocol , secureOptions ,
102
102
options . minVersion , options . maxVersion ) ;
103
- let i ;
104
- let val ;
105
103
106
104
// Add CA before the cert to be able to load cert's issuer in C++ code.
107
105
const { ca } = options ;
108
106
if ( ca ) {
109
107
if ( ArrayIsArray ( ca ) ) {
110
- for ( i = 0 ; i < ca . length ; ++ i ) {
111
- val = ca [ i ] ;
108
+ for ( const val of ca ) {
112
109
validateKeyOrCertOption ( 'ca' , val ) ;
113
110
c . context . addCACert ( val ) ;
114
111
}
@@ -123,8 +120,7 @@ exports.createSecureContext = function createSecureContext(options) {
123
120
const { cert } = options ;
124
121
if ( cert ) {
125
122
if ( ArrayIsArray ( cert ) ) {
126
- for ( i = 0 ; i < cert . length ; ++ i ) {
127
- val = cert [ i ] ;
123
+ for ( const val of cert ) {
128
124
validateKeyOrCertOption ( 'cert' , val ) ;
129
125
c . context . setCert ( val ) ;
130
126
}
@@ -142,8 +138,7 @@ exports.createSecureContext = function createSecureContext(options) {
142
138
const passphrase = options . passphrase ;
143
139
if ( key ) {
144
140
if ( ArrayIsArray ( key ) ) {
145
- for ( i = 0 ; i < key . length ; ++ i ) {
146
- val = key [ i ] ;
141
+ for ( const val of key ) {
147
142
// eslint-disable-next-line eqeqeq
148
143
const pem = ( val != undefined && val . pem !== undefined ? val . pem : val ) ;
149
144
validateKeyOrCertOption ( 'key' , pem ) ;
@@ -242,8 +237,8 @@ exports.createSecureContext = function createSecureContext(options) {
242
237
243
238
if ( options . crl ) {
244
239
if ( ArrayIsArray ( options . crl ) ) {
245
- for ( i = 0 ; i < options . crl . length ; i ++ ) {
246
- c . context . addCRL ( options . crl [ i ] ) ;
240
+ for ( const crl of options . crl ) {
241
+ c . context . addCRL ( crl ) ;
247
242
}
248
243
} else {
249
244
c . context . addCRL ( options . crl ) ;
@@ -259,8 +254,7 @@ exports.createSecureContext = function createSecureContext(options) {
259
254
toBuf = require ( 'internal/crypto/util' ) . toBuf ;
260
255
261
256
if ( ArrayIsArray ( options . pfx ) ) {
262
- for ( i = 0 ; i < options . pfx . length ; i ++ ) {
263
- const pfx = options . pfx [ i ] ;
257
+ for ( const pfx of options . pfx ) {
264
258
const raw = pfx . buf ? pfx . buf : pfx ;
265
259
const buf = toBuf ( raw ) ;
266
260
const passphrase = pfx . passphrase || options . passphrase ;
0 commit comments