Skip to content

Commit 5503092

Browse files
Trottrvagg
authored andcommitted
lib: scope loop variables
Refactor instances in `lib` where a loop variable is redeclared in the same scope with `var`. In these cases, `let` can be used to scope the variable declarations more precisely. PR-URL: #4965 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 3845940 commit 5503092

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/path.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ win32.relative = function(from, to) {
282282
}
283283

284284
var outputParts = [];
285-
for (var i = samePartsLength; i < lowerFromParts.length; i++) {
285+
for (var j = samePartsLength; j < lowerFromParts.length; j++) {
286286
outputParts.push('..');
287287
}
288288

@@ -511,7 +511,7 @@ posix.relative = function(from, to) {
511511
}
512512

513513
var outputParts = [];
514-
for (var i = samePartsLength; i < fromParts.length; i++) {
514+
for (var j = samePartsLength; j < fromParts.length; j++) {
515515
outputParts.push('..');
516516
}
517517

lib/util.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ const formatRegExp = /%[sdj%]/g;
1313
exports.format = function(f) {
1414
if (typeof f !== 'string') {
1515
var objects = [];
16-
for (var i = 0; i < arguments.length; i++) {
17-
objects.push(inspect(arguments[i]));
16+
for (var index = 0; index < arguments.length; index++) {
17+
objects.push(inspect(arguments[index]));
1818
}
1919
return objects.join(' ');
2020
}

0 commit comments

Comments
 (0)