-
Notifications
You must be signed in to change notification settings - Fork 218
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
Patch arrays generated after removing elements differs #16
Comments
Thanks for reporting this. When it comes to the order for the patches in the shim, they should be reversed (as you pointed out). When it comes to the issue of the WDYT? |
The |
Native As we see here, different implementations may produce different results depending on the direction of the algorithm. When more browsers support To me, the only logical way to sort Native Thus, in my opinion this issue should be Won't fix, but I leave this open for discussion. |
Now I have a new light on this issue... Considering this array:
Calling this will work OK:
But calling this will call exception:
Because after first patch is applied, index |
Fixed in 0.3.4 |
If we remove items from an array using
Array.prototype.splice()
the order of patches generated byjsonpatch.generate()
differs, depending on whetherjsonpatch.observe()
uses nativeObject.observe
or a shim.Lets take a sample test case:
the value stored in
objectObservePatches
iswhereas
shimPatches
contains array:Ignoring patches related to
length
property (#14) patches generated byObject.observe()
version indicate that we first removed item with index1
and then0
whereas shim version suggests something opposite.The text was updated successfully, but these errors were encountered: