param obj1 param obj2 param clobberArrays export const deepMerge = ( obj1 , obj2 , clobberArrays = false ) : any => { if ( obj2 == undefined || obj2 == null ) return obj1 ; const rootKeys = Object . keys ( obj2 ) ; rootKeys . forEach ( ( key ) => { if ( typeof obj2 [ key ] !== 'object' && obj2 [ key ] && obj2 [ key ] . constructor . name !== 'Array' ) { obj1 [ key ] = obj2 [ key ] ; } else if ( obj2 [ key ] && obj2 [ key ] . constructor . name == 'Array' && obj1 [ key ] && obj1 [ key ] . constructor . name == 'Array' ) { if ( clobberArrays ) { obj1 [ key ] = obj2 [ key ] ; } else { obj1 [ key ] . push ( ... obj2 [ key ] ) ; } } else { if ( obj1 [ key ] && typeof obj1 [ key ] === 'object' ) { obj1 [ key ] = deepMerge ( obj1 [ key ] , obj2 [ key ] , clobberArrays ) ; } else { obj1 [ key ] = obj2 [ key ] ; } } } ) ; return obj1 ; } ;