Skip to content

Commit

Permalink
Merge pull request #473 from andykog/plainObjectNoPrototype
Browse files Browse the repository at this point in the history
Concider object with null prototype a plain object
  • Loading branch information
mweststrate authored Aug 11, 2016
2 parents caaf7c8 + a9d7956 commit 80495c0
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 80495c0

Please sign in to comment.