-
-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Array diffs entirely on order and not contents #60
Comments
I think this is by design. How should your expected diff be applied to If the x = ['a', 'b', 'c']
delete x[0] // -> x = [undefined, 'b', 'c']
x[0] = 'b' // -> x = ['b', 'b', 'c']
x[1] = 'c' // -> x = ['b', 'c', 'c'] If the
The operations specified by the diff currently output by this library would be applied with these operations (which work in any order): x = ['a', 'b', 'c']
delete x[2] // -> x = ['a', 'b']
x[0] = 'b' // -> x = ['b', 'b']
x[1] = 'c' // -> x = ['b', 'c'] This applies correctly, but it is indeed a lot of work for what could be 1 Array operation. I imagine this is also why diffing large Arrays takes so long (#56). Making an Certainly possible to make. Would have to consider if it's a good fit for this library. If my idea for custom comparisons is implemented in the future, plugging in a separate library to do more compact Array diffs when necessary would be easy. |
When I diff
['a', 'b', 'c']
and['b', 'c']
, the result is:I would expect the result to be:
The text was updated successfully, but these errors were encountered: