Combining two objects and removing properties that are missing from the original
I have an external application where a user can add / remove fields from their profile. I'm trying to make a PUT API request and usually I just _.merge (original, req.body), but the updated object has multiple properties removed from the object that is not on the original object.
Is there a way to combine the objects and remove the fields that were removed on the new object are also removed from the original - while keeping the original object and concatenating the values ββthat are present on both objects (this is a mongoose model with identity properties and what I need to keep)
Thank!
+3
source to share