Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4238460

Browse filesBrowse files
author
Myles Borins
committed
lib: remove let from for loops
This is a known de-opt. It may not be 100% necessary in all cases but it seems like a decent enough idea to avoid it. Ref: #9553 PR-URL: #8873 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent 84849f1 commit 4238460
Copy full SHA for 4238460

File tree

Expand file treeCollapse file tree

5 files changed

+17
-15
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

5 files changed

+17
-15
lines changed
Open diff view settings
Collapse file

‎lib/_stream_readable.js‎

Copy file name to clipboardExpand all lines: lib/_stream_readable.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -654,14 +654,14 @@ Readable.prototype.unpipe = function(dest) {
654654
state.pipesCount = 0;
655655
state.flowing = false;
656656

657-
for (let i = 0; i < len; i++)
657+
for (var i = 0; i < len; i++)
658658
dests[i].emit('unpipe', this);
659659
return this;
660660
}
661661

662662
// try to find the right one.
663-
const i = state.pipes.indexOf(dest);
664-
if (i === -1)
663+
const index = state.pipes.indexOf(dest);
664+
if (index === -1)
665665
return this;
666666

667667
state.pipes.splice(i, 1);
Collapse file

‎lib/_tls_common.js‎

Copy file name to clipboardExpand all lines: lib/_tls_common.js
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ exports.SecureContext = SecureContext;
3434

3535
exports.createSecureContext = function createSecureContext(options, context) {
3636
if (!options) options = {};
37+
var i;
38+
var len;
3739

3840
var secureOptions = options.secureOptions;
3941
if (options.honorCipherOrder)
@@ -47,7 +49,7 @@ exports.createSecureContext = function createSecureContext(options, context) {
4749
// cert's issuer in C++ code.
4850
if (options.ca) {
4951
if (Array.isArray(options.ca)) {
50-
for (let i = 0, len = options.ca.length; i < len; i++) {
52+
for (i = 0, len = options.ca.length; i < len; i++) {
5153
c.context.addCACert(options.ca[i]);
5254
}
5355
} else {
@@ -59,7 +61,7 @@ exports.createSecureContext = function createSecureContext(options, context) {
5961

6062
if (options.cert) {
6163
if (Array.isArray(options.cert)) {
62-
for (let i = 0; i < options.cert.length; i++)
64+
for (i = 0; i < options.cert.length; i++)
6365
c.context.setCert(options.cert[i]);
6466
} else {
6567
c.context.setCert(options.cert);
@@ -72,7 +74,7 @@ exports.createSecureContext = function createSecureContext(options, context) {
7274
// which leads to the crash later on.
7375
if (options.key) {
7476
if (Array.isArray(options.key)) {
75-
for (let i = 0; i < options.key.length; i++) {
77+
for (i = 0; i < options.key.length; i++) {
7678
var key = options.key[i];
7779

7880
if (key.passphrase)
@@ -103,7 +105,7 @@ exports.createSecureContext = function createSecureContext(options, context) {
103105

104106
if (options.crl) {
105107
if (Array.isArray(options.crl)) {
106-
for (let i = 0, len = options.crl.length; i < len; i++) {
108+
for (i = 0, len = options.crl.length; i < len; i++) {
107109
c.context.addCRL(options.crl[i]);
108110
}
109111
} else {
Collapse file

‎lib/repl.js‎

Copy file name to clipboardExpand all lines: lib/repl.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ function REPLServer(prompt,
286286

287287
// After executing the current expression, store the values of RegExp
288288
// predefined properties back in `savedRegExMatches`
289-
for (let idx = 1; idx < savedRegExMatches.length; idx += 1) {
289+
for (var idx = 1; idx < savedRegExMatches.length; idx += 1) {
290290
savedRegExMatches[idx] = RegExp[`$${idx}`];
291291
}
292292

Collapse file

‎lib/tls.js‎

Copy file name to clipboardExpand all lines: lib/tls.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function check(hostParts, pattern, wildcards) {
9090
return false;
9191

9292
// Check host parts from right to left first.
93-
for (let i = hostParts.length - 1; i > 0; i -= 1)
93+
for (var i = hostParts.length - 1; i > 0; i -= 1)
9494
if (hostParts[i] !== patternParts[i])
9595
return false;
9696

Collapse file

‎lib/url.js‎

Copy file name to clipboardExpand all lines: lib/url.js
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
8989
if (typeof url !== 'string') {
9090
throw new TypeError("Parameter 'url' must be a string, not " + typeof url);
9191
}
92-
92+
var i, j, k, l;
9393
// Copy chrome, IE, opera backslash-handling behavior.
9494
// Back slashes before the query string get converted to forward slashes
9595
// See: https://code.google.com/p/chromium/issues/detail?id=25916
@@ -169,7 +169,7 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
169169

170170
// find the first instance of any hostEndingChars
171171
var hostEnd = -1;
172-
for (let i = 0; i < hostEndingChars.length; i++) {
172+
for (i = 0; i < hostEndingChars.length; i++) {
173173
const hec = rest.indexOf(hostEndingChars[i]);
174174
if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
175175
hostEnd = hec;
@@ -197,7 +197,7 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
197197

198198
// the host is the remaining to the left of the first non-host char
199199
hostEnd = -1;
200-
for (let i = 0; i < nonHostChars.length; i++) {
200+
for (i = 0; i < nonHostChars.length; i++) {
201201
const hec = rest.indexOf(nonHostChars[i]);
202202
if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
203203
hostEnd = hec;
@@ -224,12 +224,12 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
224224
// validate a little.
225225
if (!ipv6Hostname) {
226226
var hostparts = this.hostname.split(/\./);
227-
for (let i = 0, l = hostparts.length; i < l; i++) {
227+
for (i = 0, l = hostparts.length; i < l; i++) {
228228
var part = hostparts[i];
229229
if (!part) continue;
230230
if (!part.match(hostnamePartPattern)) {
231231
var newpart = '';
232-
for (let j = 0, k = part.length; j < k; j++) {
232+
for (j = 0, k = part.length; j < k; j++) {
233233
if (part.charCodeAt(j) > 127) {
234234
// we replace non-ASCII char with a temporary placeholder
235235
// we need this to make sure size of hostname is not
@@ -294,7 +294,7 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
294294
// First, make 100% sure that any "autoEscape" chars get
295295
// escaped, even if encodeURIComponent doesn't think they
296296
// need to be.
297-
for (let i = 0, l = autoEscape.length; i < l; i++) {
297+
for (i = 0, l = autoEscape.length; i < l; i++) {
298298
var ae = autoEscape[i];
299299
if (rest.indexOf(ae) === -1)
300300
continue;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.