summaryrefslogtreecommitdiff
path: root/cli/rt/02_console.js
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2020-09-25 21:36:26 +1000
committerGitHub <noreply@github.com>2020-09-25 21:36:26 +1000
commitfd1c913985df2f835612e79c3bd2d6312b57a04b (patch)
treed0941039567f813de8a9ebe9741a507e7eee410c /cli/rt/02_console.js
parent01147fab80cdcc837c160e5d21ed8276839777ef (diff)
fix(cli): customInspect works on functions (#7670)
Fixes #7650
Diffstat (limited to 'cli/rt/02_console.js')
-rw-r--r--cli/rt/02_console.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/cli/rt/02_console.js b/cli/rt/02_console.js
index 0b5931616..ab91ffc09 100644
--- a/cli/rt/02_console.js
+++ b/cli/rt/02_console.js
@@ -193,6 +193,11 @@
}
function inspectFunction(value, _ctx) {
+ if (customInspect in value && typeof value[customInspect] === "function") {
+ try {
+ return String(value[customInspect]());
+ } catch {}
+ }
// Might be Function/AsyncFunction/GeneratorFunction
const cstrName = Object.getPrototypeOf(value).constructor.name;
if (value.name && value.name !== "anonymous") {