Open yannsartori opened 3 years ago
Please explain why you would want to do that?
If one would like to see a more refined diff for their list. If I have ['a', 'b', 'c']
becoming ['a', 'c', 'd']
, rather than just seeing in the diff "value is now ['a', 'c', 'd']
", I could see "'b' was removed and 'd' appended".
Also in a situation in which you have only removed one item, for example: with a list of {a: [1, 2, 3]}
becoming {a: [1, 2]}
It is a lot less heavy handed to say {op: remove, path: /a/2}
than{op: replace, path: /a, value: [1, 2]}
. I do understand that in almost every scenario it is programmatically faster to do a replace, but you are being kind of disingenuous since it's not actually one patch per change, instead you are condensing potentially many changes into 1.
Any updates on this?
It should just be a matter of adding many tests with a
and b
in diff.json
and completing patch
with what your implementation comes up with - double check it makes sense and you're good to go.
This change would utilize add/remove for the patch operation rather than just a replace.