From be95b89fc850b23d091ba5a6f310c8e0c31de558 Mon Sep 17 00:00:00 2001 From: Taye Adeyemi Date: Fri, 13 Apr 2018 10:19:16 +0200 Subject: [PATCH] utils/is: fix plainObject on constructorless thing --- packages/utils/is.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/utils/is.js b/packages/utils/is.js index 4aca368f4..146363ffe 100644 --- a/packages/utils/is.js +++ b/packages/utils/is.js @@ -25,7 +25,9 @@ export const element = thing => { : thing.nodeType === 1 && typeof thing.nodeName === 'string'); }; -export const plainObject = thing => object(thing) && thing.constructor.name === 'Object'; +export const plainObject = thing => object(thing) && + !!thing.constructor && + thing.constructor.name === 'Object'; export const array = thing => (object(thing) && (typeof thing.length !== 'undefined')