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: https://github.com/nodejs/node/pull/4965
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Rich Trott authored and Myles Borins committed 2016-03-02 14:01:11 -08:00
1 parent 46b6191ac5
commit 4079b5e858
2 files changed
+4 -4

No files matched your search

+2 -2
View File
@@ -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('..');
}
@@ -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('..');
}
+2 -2
View File
@@ -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(' ');
}