My goal
My goal is merge the object including object in object. Example I have two objects A and B
Object A = {
money: 100,
'a':{money:20,happy:99}
};
Object B = {
happy: 100
'a':{lucky:-5}
};
I run merge code:
console.log(Object.assign({},A,B));
The result
had a little bit problem about properties of object in object you will see I lost some data until properties of object is fine
{
money:100,
happy:100,
'a':{lucky:-5}
}
Expected
The result should be merge all including properties of object in object
{
money:100,
happy:100,
'a':{money:20,happy:99,lucky:-5}
}
I tried to search about my question but I only found about merge object (not object in object) if this question is duplicated I apologise.
Found Solution for node (npm)
const mergeObj = require("object-merge-advanced");
mergeObj(A,B)