From fd1c913985df2f835612e79c3bd2d6312b57a04b Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Fri, 25 Sep 2020 21:36:26 +1000 Subject: fix(cli): customInspect works on functions (#7670) Fixes #7650 --- cli/rt/02_console.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cli/rt/02_console.js') 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") { -- cgit v1.2.3