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
I have a scenario where sometimes I want object diff to be considered as the whole object, and sometimes just as a partial object. When applying a partial object, if an existing key isn't provided I want it to just leave it as is. A deep merge option built in could be nice and is I believe can be done very simply.
The way I'm handling this now is after doing a diff, I'm looping through the changes and removing any remove operation:
let changes = diff(this.data, data);
if (merge) {
changes = changes.filter((change) => change.op === 'remove');
}
diffApply(this.data, changes);
For big objects, performance could benefit from this being built in where either diff optionally doesnt include remove operations or when doing diffApply it optionally skips the removals.
I have a scenario where sometimes I want object diff to be considered as the whole object, and sometimes just as a partial object. When applying a partial object, if an existing key isn't provided I want it to just leave it as is. A deep merge option built in could be nice and is I believe can be done very simply.
The way I'm handling this now is after doing a diff, I'm looping through the changes and removing any remove operation:
For big objects, performance could benefit from this being built in where either diff optionally doesnt include remove operations or when doing diffApply it optionally skips the removals.
Looking through the documentation, I don't believe this is currently possible.
The text was updated successfully, but these errors were encountered: