diff options
author | Tomislav Fabeta <tomislav.fabeta@gmail.com> | 2019-04-22 15:37:49 +0100 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-04-22 10:37:49 -0400 |
commit | d9408017541ffe6c86f4904973c22f829ade1ac4 (patch) | |
tree | 509cdd230d442ca70aa2640ac05f27c248ed3c0e /js/console.ts | |
parent | 1d4b92ac85d8c850270ca859f928404c72c0a49a (diff) |
Simplify logic in URLSearchParams, Buffer, Console (#2174)
Diffstat (limited to 'js/console.ts')
-rw-r--r-- | js/console.ts | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/js/console.ts b/js/console.ts index b2f7e7cbb..169ff83fb 100644 --- a/js/console.ts +++ b/js/console.ts @@ -53,12 +53,15 @@ function getClassInstanceName(instance: unknown): string { if (typeof instance !== "object") { return ""; } - if (instance) { - const proto = Object.getPrototypeOf(instance); - if (proto && proto.constructor) { - return proto.constructor.name; // could be "Object" or "Array" - } + if (!instance) { + return ""; } + + const proto = Object.getPrototypeOf(instance); + if (proto && proto.constructor) { + return proto.constructor.name; // could be "Object" or "Array" + } + return ""; } |