function Foo() {
this.a = 1;
}
function Bar() {
this.c = 3;
}
Foo.prototype.b = 2;
Bar.prototype.d = 4;
const obj0 = { 'a': 0 }
const obj1 = {...obj0 }
const obj2 = {...obj0 }
_.assignIn(obj1, new Foo, new Bar);
_.assign(obj2, new Foo, new Bar);
console.log('obj1', obj1)
console.log('obj2', obj2)
function customizer(objValue, srcValue, key, object, source) {
console.log(key, srcValue, object)
//return _.isUndefined(objValue) ? srcValue : objValue;
//return key in object? srcValue: undefined
if (key in object) {
return 'x'
} else {
return undefined
}
}
const obj3 = {...obj0}
_.assignWith(obj3, {'a': 1, 'b': 4}, customizer)
console.log('obj3', obj3)
console