I have 2 objects.
The one object is Original Data
.
const origin = { name: 'John', id: 'Doe', item: { drink: 'coffee', money: 0 } }
And the other object is Copied and Edited Data
const copied = { name: 'Alex', id: 'Doe', item: { drink: 'water', money: 0 } }
I would like to compare them and get diff only.
const out = compareObj(origin, copied);
console.log(out)
/*
{ name: 'Alex', item: { drink: 'water' } }
*/
How can I get this?
Thanks in advance.