-
Notifications
You must be signed in to change notification settings - Fork 148
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
bug in replace array in json #18
Comments
Agreed, thanks for pointing out the issue. Clearly, the diffs generated are not optimized in this case. |
Hi, I've looked at the code a bit and I think the underlying issue is that REPLACE operations are not collapsed. Take the following arrays: source: [1, 2, 3, 4, 5] You will get, REMOVE 1, REPLACE 2 5, ADD 1, REPLACE 3, 4, REPLACE 4, 3, REMOVE 5, ADD 2 To reduce this into moves you would need the following: Obviously you need to keep track of coordinates as well. The optimization that is currently in place only collapses REMOVE and ADD into MOVE, it doesn't take into account these chains of replacements. Sadly I won't have enough time to code this myself right now, but thought it might help if someone else wanted to tackle it. |
What about this bug? It's been created more than 3 years ago |
hi, thanks for this great library.
when I'm getting different between this two jsons
and
the difference value currectly return operation replace in location 0.
but if I get diff this two jsons
and
it returns add and remove operation in 0 and 2 positions.
I think the reason of this bug is because of two number 2 .
The text was updated successfully, but these errors were encountered: