Skip to content

Commit

Permalink
fix: avoid optional chaining
Browse files Browse the repository at this point in the history
for Nuxt2 and Webpack4's sake
  • Loading branch information
pi0 committed Dec 14, 2021
1 parent 8c97293 commit 931d12d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ export function isJSONSerializable (val: any) {
if (Array.isArray(val)) {
return true
}
return val.constructor?.name === 'Object' || typeof val.toJSON === 'function'
return (val.constructor && val.constructor.name === 'Object') ||
typeof val.toJSON === 'function'
}

0 comments on commit 931d12d

Please sign in to comment.