Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
cronvel committed Sep 17, 2021
1 parent e6defff commit d07a0ec
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/extend.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ function extendOne( runtime , options , target , source ) {
}

targetPointer = target ;
console.log( "targetValue1:" , targetPointer , targetKey , targetPointer?.[ targetKey ] ) ;
targetKey = runtime.prefix + sourceKey ;

// Do not copy if property is a function and we don't want them
Expand All @@ -212,9 +213,10 @@ function extendOne( runtime , options , target , source ) {
targetKey = runtime.prefix + path[ jmax ] ;
}
}

// Again, trigger an eventual getter only once
targetValue = targetPointer[ targetKey ] ;
console.log( "targetValue2:" , targetPointer , targetKey , targetPointer?.[ targetKey ] ) ;
targetValue = targetPointer?.[ targetKey ] ;
targetValueIsObject = targetValue && ( typeof targetValue === 'object' || typeof targetValue === 'function' ) ;
sourceValueIsObject = sourceValue && ( typeof sourceValue === 'object' || typeof sourceValue === 'function' ) ;

Expand Down Expand Up @@ -253,7 +255,7 @@ function extendOne( runtime , options , target , source ) {
} ) ;
}
else {
targetValue = targetPointer[ targetKey ] = runtime.references.targets[ indexOfSource ] ;
targetPointer[ targetKey ] = targetValue = runtime.references.targets[ indexOfSource ] ;
}

continue ;
Expand All @@ -275,7 +277,7 @@ function extendOne( runtime , options , target , source ) {
} ) ;
}
else {
targetValue = targetPointer[ targetKey ] = value ;
targetPointer[ targetKey ] = targetValue = value ;
}
}
else if ( options.proto && Object.getPrototypeOf( targetValue ) !== sourceValueProto ) {
Expand Down Expand Up @@ -308,7 +310,7 @@ function extendOne( runtime , options , target , source ) {
}
else if ( ! options.inherit ) {
if ( options.descriptor ) { Object.defineProperty( targetPointer , targetKey , sourceDescriptor ) ; }
else { targetValue = targetPointer[ targetKey ] = sourceValue ; }
else { targetPointer[ targetKey ] = targetValue = sourceValue ; }
}

// Delete owned property of the source object
Expand Down

0 comments on commit d07a0ec

Please sign in to comment.