Skip to content

Commit

Permalink
utils/is: fix plainObject on constructorless thing
Browse files Browse the repository at this point in the history
  • Loading branch information
taye committed Apr 13, 2018
1 parent f03fed8 commit be95b89
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/utils/is.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit be95b89

Please sign in to comment.