Skip to content

Commit

Permalink
lib: scope loop variables
Browse files Browse the repository at this point in the history
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 <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Trott authored and rvagg committed Feb 8, 2016
1 parent 3845940 commit 5503092
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ win32.relative = function(from, to) {
}

var outputParts = [];
for (var i = samePartsLength; i < lowerFromParts.length; i++) {
for (var j = samePartsLength; j < lowerFromParts.length; j++) {
outputParts.push('..');
}

Expand Down Expand Up @@ -511,7 +511,7 @@ posix.relative = function(from, to) {
}

var outputParts = [];
for (var i = samePartsLength; i < fromParts.length; i++) {
for (var j = samePartsLength; j < fromParts.length; j++) {
outputParts.push('..');
}

Expand Down
4 changes: 2 additions & 2 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const formatRegExp = /%[sdj%]/g;
exports.format = function(f) {
if (typeof f !== 'string') {
var objects = [];
for (var i = 0; i < arguments.length; i++) {
objects.push(inspect(arguments[i]));
for (var index = 0; index < arguments.length; index++) {
objects.push(inspect(arguments[index]));
}
return objects.join(' ');
}
Expand Down

0 comments on commit 5503092

Please sign in to comment.