diff options
author | Colin Ihrig <cjihrig@gmail.com> | 2022-06-13 10:59:22 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-13 10:59:22 -0400 |
commit | 64abb65f0514afc1f10c426561e5150d9cae6b45 (patch) | |
tree | 33bb5a45945acbb8335cfae7719334d038621f60 /ext/console/02_console.js | |
parent | 7b1662a8e648d01a1f4af4623f3deea7ab8d1432 (diff) |
feat(console): pass options and depth to custom inspects (#14855)
This commit updates Deno.inspect() to pass inspect options and
the current inspect depth to custom inspect functions.
Refs: https://github.com/denoland/deno/issues/8099
Refs: https://github.com/denoland/deno/issues/14171
Diffstat (limited to 'ext/console/02_console.js')
-rw-r--r-- | ext/console/02_console.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/console/02_console.js b/ext/console/02_console.js index 638047b3a..71eb58198 100644 --- a/ext/console/02_console.js +++ b/ext/console/02_console.js @@ -335,7 +335,7 @@ ReflectHas(value, customInspect) && typeof value[customInspect] === "function" ) { - return String(value[customInspect](inspect)); + return String(value[customInspect](inspect, inspectOptions, level)); } // Might be Function/AsyncFunction/GeneratorFunction/AsyncGeneratorFunction let cstrName = ObjectGetPrototypeOf(value)?.constructor?.name; @@ -1258,7 +1258,7 @@ ReflectHas(value, customInspect) && typeof value[customInspect] === "function" ) { - return String(value[customInspect](inspect)); + return String(value[customInspect](inspect, inspectOptions, level)); } // This non-unique symbol is used to support op_crates, ie. // in extensions/web we don't want to depend on public @@ -1273,7 +1273,9 @@ // inspect implementations in `extensions` need it, but may not have access // to the `Deno` namespace in web workers. Remove when the `Deno` // namespace is always enabled. - return String(value[privateCustomInspect](inspect)); + return String( + value[privateCustomInspect](inspect, inspectOptions, level), + ); } if (ObjectPrototypeIsPrototypeOf(ErrorPrototype, value)) { return inspectError(value, maybeColor(colors.cyan, inspectOptions)); |