Let's assume I have below object
let obj = {
    id:1,
    likes: 20,
    createdBy: 'tom'
}
Then I create new object which is used to record the changes.
let dynamicObject = obj;
obj.likes = 30;
createdBy = 'ken';
// which should be
//  {
//     id:1,
//     likes: 30,
//     createdBy: 'ken'
//  }
I want to create a function like below, so as to get the changes of the object for my PATCH request.
someFunc(obj, dynamicObject)
which return
 {
    likes: 30,
    createdBy: 'ken'
 }
Is there any library or method to do it?
 
     
    