File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -94,13 +94,18 @@ function merge(src, dest) {
9494 var topKeys = Object . keys ( src ) ;
9595 for ( var i = 0 ; i < topKeys . length ; i ++ ) {
9696 var topKey = topKeys [ i ] ;
97- var child = src [ topKey ] ;
98- var childKeys = Object . keys ( child ) ;
99- for ( var j = 0 ; j < childKeys . length ; j ++ ) {
100- var childKey = childKeys [ j ] ;
101- var childValue = child [ childKey ] ;
102- if ( childValue !== undefined ) {
103- dest [ topKey ] [ childKey ] = childValue ;
97+ var srcChild = src [ topKey ] ;
98+ if ( dest [ topKey ] === undefined ) {
99+ dest [ topKey ] = srcChild ;
100+ }
101+ else {
102+ var childKeys = Object . keys ( srcChild ) ;
103+ for ( var j = 0 ; j < childKeys . length ; j ++ ) {
104+ var childKey = childKeys [ j ] ;
105+ var srcChildValue = srcChild [ childKey ] ;
106+ if ( srcChildValue !== undefined ) {
107+ dest [ topKey ] [ childKey ] = srcChildValue ;
108+ }
104109 }
105110 }
106111 }
You can’t perform that action at this time.
0 commit comments