From a9d7956ecdd660dc8f951e7fe200afad9dad2a3c Mon Sep 17 00:00:00 2001 From: Andrey Kogut Date: Wed, 10 Aug 2016 20:06:42 +0300 Subject: [PATCH] Concider object with null prototype a plain object --- src/utils/utils.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/utils.ts b/src/utils/utils.ts index af40243d1..b757c8046 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -55,7 +55,10 @@ export function joinStrings(things: string[], limit: number = 100, separator = " } export function isPlainObject(value) { - return value !== null && typeof value === "object" && Object.getPrototypeOf(value) === Object.prototype; + if (value === null || typeof value !== "object") + return false; + const proto = Object.getPrototypeOf(value); + return proto === Object.prototype || proto === null; } export function objectAssign(...objs: Object[]): Object;