summaryrefslogtreecommitdiff
path: root/lib/internal/util/inspect.js
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2019-05-16 13:09:31 +0200
committerRuben Bridgewater <ruben@bridgewater.de>2019-05-20 14:15:40 +0200
commit79e55f07741dcd31f28be4a322629400380fef3e (patch)
treeb196fc13b3cfb24c13385de22e1394c40667ded9 /lib/internal/util/inspect.js
parentf1a3968a01f2d76fff3d1b677aaefc752661c448 (diff)
downloadandroid-node-v8-79e55f07741dcd31f28be4a322629400380fef3e.tar.gz
android-node-v8-79e55f07741dcd31f28be4a322629400380fef3e.tar.bz2
android-node-v8-79e55f07741dcd31f28be4a322629400380fef3e.zip
util: simplify inspection limit handling
This simplifies the handling of objects that exceed 128mb. Instead of using a separate property to identify that all following inputs should only return their constructor name it'll just set the depth to -1. That has the almost the same behavior as before while providing a better output in some cases. The performance should be almost identical as well. PR-URL: https://github.com/nodejs/node/pull/27733 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Diffstat (limited to 'lib/internal/util/inspect.js')
-rw-r--r--lib/internal/util/inspect.js9
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js
index 850740d3c2..2d5080bd6d 100644
--- a/lib/internal/util/inspect.js
+++ b/lib/internal/util/inspect.js
@@ -520,17 +520,12 @@ function formatValue(ctx, value, recurseTimes, typedArray) {
// any proxy handlers.
const proxy = getProxyDetails(value);
if (proxy !== undefined) {
- if (ctx.showProxy && ctx.stop === undefined) {
+ if (ctx.showProxy) {
return formatProxy(ctx, proxy, recurseTimes);
}
value = proxy[0];
}
- if (ctx.stop !== undefined) {
- const name = getConstructorName(value, ctx) || value[Symbol.toStringTag];
- return ctx.stylize(`[${name || 'Object'}]`, 'special');
- }
-
// Provide a hook for user-specified inspect functions.
// Check that value is an object with an inspect function on it.
if (ctx.customInspect) {
@@ -788,7 +783,7 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
// This limit also makes sure that huge objects don't block the event loop
// significantly.
if (newLength > 2 ** 27) {
- ctx.stop = true;
+ ctx.depth = -1;
}
return res;
}