Add an option to keep unmodified values
syskin opened this issue · 2 comments
Hi,
Thank you for your library that we use in our company, it is excellent for our needs.
We are currently using the diff function without options, which returns this type of response. However we find it awkward in our context not to have the unmodified values of an array.
"updatedScope": {
"value": {"__old": "test", "__new": "dev"},
"values": [ [" "], ["+", "item1"]]
}
We have tested the full
option, which is not adapted to our case because it returns the whole object, with the values out of context.
{
"nonModifiedScope": {...},
"updatedScope": {
"value": {"__old": "test", "__new": "dev"},
"values": [ [" ", "item0"], ["+", "item1"]]
}
}
I would like to suggest an improvement that would allow to keep the unmodified values in the diff of an object, without returning the whole object.
This would consist in adding an option, for example keepUnchangedValues: boolean
, which would be taken into account here in the same way as the full
option, while remaining in the context of modified values.
ideal answer will look like that:
"updatedScope": {
"value": {"__old": "test", "__new": "dev"},
"values": [ [" ", "item0"], ["+", "item1"]]
}
What do you think of this option which would bring a lot of clarity in the context of the modified values scope?
Thank you, Syskin. That seems like a reasonable change if you want to submit a PR for it. -Eric
Shouldn't this be closed now that #86 has been merged?