Skip to content

Commit

Permalink
fix: πŸ› support data which no prototype
Browse files Browse the repository at this point in the history
support the data like Object.create(null)
  • Loading branch information
wqcstrong committed Apr 24, 2023
1 parent 6bc8857 commit 5835960
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ export function makePrimitiveValue(value: any): PrimitiveResult {
if (value === undefined) {
return primitive(stringify(value));
}
if (value === null) {
return primitive(value);
}
if (isNumber(value)) {
if (value === -Infinity || value === Infinity || Number.isNaN(value)) {
return primitive(stringify(value));
Expand All @@ -121,7 +124,7 @@ export function makePrimitiveValue(value: any): PrimitiveResult {
ok: false,
};
}
if (!(value instanceof Object || value instanceof Array)) {
if (!(value instanceof Object || typeof value === 'object')) {
return primitive(value);
}
return {
Expand Down

0 comments on commit 5835960

Please sign in to comment.