From d9408017541ffe6c86f4904973c22f829ade1ac4 Mon Sep 17 00:00:00 2001 From: Tomislav Fabeta Date: Mon, 22 Apr 2019 15:37:49 +0100 Subject: Simplify logic in URLSearchParams, Buffer, Console (#2174) --- js/console.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'js/console.ts') 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 ""; } -- cgit v1.2.3