File tree Expand file tree Collapse file tree
packages/vee-validate/src/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ import { Locator, YupValidator } from '../types';
22import { isCallable , isObject } from '../../../shared' ;
33import { IS_ABSENT } from '../symbols' ;
44
5+ export const isClient = typeof window !== 'undefined' ;
6+
57export function isLocator ( value : unknown ) : value is Locator {
68 return isCallable ( value ) && ! ! ( value as Locator ) . __locatorRef ;
79}
@@ -142,7 +144,7 @@ export function isEqual(a: any, b: any) {
142144
143145 // We added this part for file comparison, arguably a little naive but should work for most cases.
144146 // #3911
145- if ( a instanceof File && b instanceof File ) {
147+ if ( isFile ( a ) && isFile ( b ) ) {
146148 if ( a . size !== b . size ) return false ;
147149 if ( a . name !== b . name ) return false ;
148150 if ( a . lastModified !== b . lastModified ) return false ;
@@ -189,3 +191,11 @@ export function isEqual(a: any, b: any) {
189191 // eslint-disable-next-line no-self-compare
190192 return a !== a && b !== b ;
191193}
194+
195+ export function isFile ( a : unknown ) : a is File {
196+ if ( ! isClient ) {
197+ return false ;
198+ }
199+
200+ return a instanceof File ;
201+ }
You can’t perform that action at this time.
0 commit comments