Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
util: avoid using forEach
PR-URL: #11582
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
jasnell authored and italoacasas committed Mar 20, 2017
1 parent 5b1d61c commit 9a59913
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions lib/util.js
Expand Up @@ -682,12 +682,13 @@ function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
if (remaining > 0) {
output.push(`... ${remaining} more item${remaining > 1 ? 's' : ''}`);
}
keys.forEach(function(key) {
for (var n = 0; n < keys.length; n++) {
var key = keys[n];
if (typeof key === 'symbol' || !key.match(/^\d+$/)) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
key, true));
}
});
}
return output;
}

Expand Down Expand Up @@ -718,10 +719,10 @@ function formatSet(ctx, value, recurseTimes, visibleKeys, keys) {
var str = formatValue(ctx, v, nextRecurseTimes);
output.push(str);
});
keys.forEach(function(key) {
for (var n = 0; n < keys.length; n++) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
key, false));
});
keys[n], false));
}
return output;
}

Expand All @@ -735,10 +736,10 @@ function formatMap(ctx, value, recurseTimes, visibleKeys, keys) {
str += formatValue(ctx, v, nextRecurseTimes);
output.push(str);
});
keys.forEach(function(key) {
for (var n = 0; n < keys.length; n++) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
key, false));
});
keys[n], false));
}
return output;
}

Expand Down Expand Up @@ -768,10 +769,10 @@ function formatPromise(ctx, value, recurseTimes, visibleKeys, keys) {
output.push(str);
}
}
keys.forEach(function(key) {
for (var n = 0; n < keys.length; n++) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
key, false));
});
keys[n], false));
}
return output;
}

Expand Down

0 comments on commit 9a59913

Please sign in to comment.