1- import { isMatch } from './matcher'
2-
31export function isArray ( object : any ) : boolean {
42 return Object . prototype . toString . call ( object ) === '[object Array]'
53}
@@ -16,10 +14,9 @@ export function isFile(object: any): boolean {
1614
1715export function merge ( a : any , b : any ) : string [ ] {
1816 for ( const key in b ) {
19- if ( ! b . hasOwnProperty ( key ) ) {
20- continue
17+ if ( Object . prototype . hasOwnProperty . call ( b , key ) ) {
18+ a [ key ] = cloneDeep ( b [ key ] )
2119 }
22- a [ key ] = cloneDeep ( b [ key ] )
2320 }
2421 return a
2522}
@@ -37,7 +34,7 @@ export function cloneDeep(object: any): any {
3734 const clone : string [ ] = [ ]
3835
3936 for ( const key in object ) {
40- if ( object . hasOwnProperty ( key ) ) {
37+ if ( Object . prototype . hasOwnProperty . call ( object , key ) ) {
4138 clone [ key ] = cloneDeep ( object [ key ] )
4239 }
4340 }
@@ -49,7 +46,7 @@ export function cloneDeep(object: any): any {
4946 const clone = { }
5047
5148 for ( const key in object ) {
52- if ( object . hasOwnProperty ( key ) ) {
49+ if ( Object . prototype . hasOwnProperty . call ( object , key ) ) {
5350 clone [ key ] = cloneDeep ( object [ key ] )
5451 }
5552 }
@@ -61,9 +58,6 @@ export function cloneDeep(object: any): any {
6158}
6259
6360export function is ( errors : any , error : any ) : boolean {
64- if ( typeof error === 'string' && error . match ( / [ \* \! ] / ) ) {
65- return errors . filter ( ( w : any ) => isMatch ( w , error ) ) . length > 0
66- }
6761 return isArray ( error )
6862 ? error . some ( ( w ) => is ( errors , w ) )
6963 : errors . includes ( error )
0 commit comments