diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2020-09-25 21:36:26 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-25 21:36:26 +1000 |
commit | fd1c913985df2f835612e79c3bd2d6312b57a04b (patch) | |
tree | d0941039567f813de8a9ebe9741a507e7eee410c /cli/rt/02_console.js | |
parent | 01147fab80cdcc837c160e5d21ed8276839777ef (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.js | 5 |
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") { |