Skip to content

Commit

Permalink
Concider object with null prototype a plain object
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Kogut committed Aug 10, 2016
1 parent 59a14f0 commit a9d7956
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a9d7956

Please sign in to comment.