summaryrefslogtreecommitdiff
path: root/cli/rt/02_console.js
diff options
context:
space:
mode:
Diffstat (limited to 'cli/rt/02_console.js')
-rw-r--r--cli/rt/02_console.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/cli/rt/02_console.js b/cli/rt/02_console.js
index b07ccf187..b6f5bc74b 100644
--- a/cli/rt/02_console.js
+++ b/cli/rt/02_console.js
@@ -764,6 +764,19 @@
return String(value[customInspect]());
} catch {}
}
+ // This non-unique symbol is used to support op_crates, ie.
+ // in op_crates/web we don't want to depend on unique "Deno.customInspect"
+ // symbol defined in the public API. Internal only, shouldn't be used
+ // by users.
+ const nonUniqueCustomInspect = Symbol.for("Deno.customInspect");
+ if (
+ nonUniqueCustomInspect in value &&
+ typeof value[nonUniqueCustomInspect] === "function"
+ ) {
+ try {
+ return String(value[nonUniqueCustomInspect]());
+ } catch {}
+ }
if (value instanceof Error) {
return String(value.stack);
} else if (Array.isArray(value)) {