Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <rosaxny@gmail.com>2020-07-16 19:28:09 +0300
committerAnna Henningsen <anna@addaleax.net>2020-07-28 15:30:52 +0300
commitfe2a7f052f65f20e3c325e7525fdab7128c2f72c (patch)
tree62cd457f1f7da56d4da7b13bd06697c052e80323 /lib/internal/util
parent53870ddeac8b115f7bba070c2fcd0f5e31ecc9da (diff)
util: print External address from inspect
Fixes: https://github.com/nodejs/node/issues/28250 PR-URL: https://github.com/nodejs/node/pull/34398 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Diffstat (limited to 'lib/internal/util')
-rw-r--r--lib/internal/util/inspect.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js
index 13ec60f7773..102d6f0f153 100644
--- a/lib/internal/util/inspect.js
+++ b/lib/internal/util/inspect.js
@@ -63,6 +63,7 @@ const {
kRejected,
previewEntries,
getConstructorName: internalGetConstructorName,
+ getExternalValue,
propertyFilter: {
ALL_PROPERTIES,
ONLY_ENUMERABLE
@@ -977,8 +978,10 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
}
} else {
if (keys.length === 0 && protoProps === undefined) {
- if (isExternal(value))
- return ctx.stylize('[External]', 'special');
+ if (isExternal(value)) {
+ const address = getExternalValue(value).toString(16);
+ return ctx.stylize(`[External: ${address}]`, 'special');
+ }
return `${getCtxStyle(value, constructor, tag)}{}`;
}
braces[0] = `${getCtxStyle(value, constructor, tag)}{`;