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 jasnell committed Feb 1, 2016
1 parent 1684957 commit 089d84f
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 @@ -503,7 +503,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 089d84f

Please sign in to comment.