File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,21 +4,20 @@ import { dirname, join } from 'path'
44
55// Deep merge function to handle nested objects
66export function deepMerge ( target , source ) {
7+ if ( ! isObject ( target ) || ! isObject ( source ) ) {
8+ return source
9+ }
10+
711 const output = { ...target }
812
9- if ( isObject ( target ) && isObject ( source ) ) {
10- Object . keys ( source ) . forEach ( key => {
11- if ( isObject ( source [ key ] ) ) {
12- if ( ! ( key in target ) ) {
13- output [ key ] = source [ key ]
14- } else {
15- output [ key ] = deepMerge ( target [ key ] , source [ key ] )
16- }
17- } else {
18- output [ key ] = source [ key ]
19- }
20- } )
21- }
13+ Object . keys ( source ) . forEach ( key => {
14+ if ( isObject ( source [ key ] ) && isObject ( target [ key ] ) ) {
15+ output [ key ] = deepMerge ( target [ key ] , source [ key ] )
16+ return
17+ }
18+
19+ output [ key ] = source [ key ]
20+ } )
2221
2322 return output
2423}
You can’t perform that action at this time.
0 commit comments