diff --git a/lib/util.js b/lib/util.js index 8c880c674b5ad3..3378109b6126ed 100644 --- a/lib/util.js +++ b/lib/util.js @@ -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; } @@ -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; } @@ -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; } @@ -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; }