summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/util.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/util.js b/lib/util.js
index 737ad5d0b4..762461402e 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -456,6 +456,11 @@ function formatValue(ctx, value, recurseTimes, ln) {
}
}
+ // Using an array here is actually better for the average case than using
+ // a Set. `seen` will only check for the depth and will never grow too large.
+ if (ctx.seen.indexOf(value) !== -1)
+ return ctx.stylize('[Circular]', 'special');
+
let keys;
let symbols = Object.getOwnPropertySymbols(value);
@@ -640,11 +645,6 @@ function formatValue(ctx, value, recurseTimes, ln) {
}
}
- // Using an array here is actually better for the average case than using
- // a Set. `seen` will only check for the depth and will never grow too large.
- if (ctx.seen.indexOf(value) !== -1)
- return ctx.stylize('[Circular]', 'special');
-
if (recurseTimes != null) {
if (recurseTimes < 0)
return ctx.stylize(`[${constructor || tag || 'Object'}]`, 'special');