From 0328478b651059b26440c0f331d7645442b43801 Mon Sep 17 00:00:00 2001 From: Touch Date: Thu, 22 Oct 2020 21:46:33 +0700 Subject: [PATCH] chore(fix): :tada: check is node process or browser --- src/core/BaseProxy.ts | 3 +++ src/util/objects.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/core/BaseProxy.ts b/src/core/BaseProxy.ts index 591fa3a9..18132c69 100644 --- a/src/core/BaseProxy.ts +++ b/src/core/BaseProxy.ts @@ -115,6 +115,9 @@ class BaseProxy { if (!form.hasOwnProperty(property)) { return false } + if (typeof window === 'undefined') { + return false + } if (this.__hasFilesDeep(form[property])) { return true } diff --git a/src/util/objects.ts b/src/util/objects.ts index b216c1dc..b6c080e4 100644 --- a/src/util/objects.ts +++ b/src/util/objects.ts @@ -5,6 +5,9 @@ export function isArray(object: any): boolean { } export function isFile(object: any): boolean { + if (typeof window === 'undefined') { + return false + } if (typeof File !== 'function' || typeof FileList !== 'function') { return false }