From 931d12d945d5bc014b34f46d93a627dbb4eda3a7 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Tue, 14 Dec 2021 16:31:58 +0100 Subject: [PATCH] fix: avoid optional chaining for Nuxt2 and Webpack4's sake --- src/utils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils.ts b/src/utils.ts index e756667..5237a5d 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -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' }