diff options
Diffstat (limited to 'cli/rt/02_console.js')
-rw-r--r-- | cli/rt/02_console.js | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/cli/rt/02_console.js b/cli/rt/02_console.js index 8c853deb9..72192eda4 100644 --- a/cli/rt/02_console.js +++ b/cli/rt/02_console.js @@ -175,18 +175,13 @@ /* eslint-disable @typescript-eslint/no-use-before-define */ function getClassInstanceName(instance) { - if (typeof instance !== "object") { + if (typeof instance != "object") { return ""; } - if (!instance) { - return ""; - } - - const proto = Object.getPrototypeOf(instance); - if (proto && proto.constructor) { - return proto.constructor.name; // could be "Object" or "Array" + const constructor = instance?.constructor; + if (typeof constructor == "function") { + return constructor.name ?? ""; } - return ""; } |