diff --git a/lib/util.js b/lib/util.js index 9e61bd83e05541..b243c81dd50e7b 100644 --- a/lib/util.js +++ b/lib/util.js @@ -677,12 +677,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; } @@ -713,10 +714,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; } @@ -730,10 +731,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; } @@ -763,10 +764,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; }