You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importmergefrom'merge-deep';constobject1={a: '1',b: '2',c: [1,2,3]};constobject2={a: undefined,b: null,c: null};// 'c' property might be anything else, like '1', or undefined, or an empty Array, doesn't matterconstmergedObject=merge(object1,object2);console.log(mergedObject);=>{a: undefined,b: null,c: [1,2,3]}// So, the last property is not changed.
If 'c' in the object2 was 'abc', we'll get
=>{a: undefined,b: null,c: ['abc',1,2,3]}
It looks like Array type values concat, instead of be replaced with a new value. But I need a tool to replace values while merging.
Should I use assign-deep instead? Cause the last one does it well.
The text was updated successfully, but these errors were encountered:
I'm not sure, if this a bug or a feature. Look:
If 'c' in the object2 was 'abc', we'll get
It looks like Array type values concat, instead of be replaced with a new value. But I need a tool to replace values while merging.
Should I use assign-deep instead? Cause the last one does it well.
The text was updated successfully, but these errors were encountered: