-
Notifications
You must be signed in to change notification settings - Fork 84
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 detectMove #14
Comments
I might be wrong, but this is not the purpose of that library. Though you can easily achieve that by first bringing JSON to some canonical form (e.g. sort all arrays in your case). |
@arbitertl I think it makes sense to add this. jsondiffpatch.net is just a port of benjamine/jsondiffpatch after all and that library does support this feature. If any of you guys want to write the code, feel free, if not I'll eventually get around to it when I have more free time. |
I'd be happy to have a go at this. Did you have any specific approach in mind, or shall I just forge ahead? |
Hey @dimi3tron, thanks for volunteering! I don't have specific requirements, but as a guiding principle, I would really love it if you could implement in a way that mimics the default behavior of the original library. Thanks! |
Okay. I'm going by https://github.com/benjamine/jsondiffpatch/blob/master/docs/arrays.md. It pretty much describes what I had in mind anyway. |
I implemented the basic detectmove algorithm. I works fine for arrays of primitive types and strings. I'd have to look at the original code, but I suspect some refactoring will need to be done to get this in place. How do I go about committing my changes? |
@dimi3tron Do you have your changes available in a repository somewhere? This library looks to be ideal for a project I'm working on but I really need the array move detection. |
Is there any update on this? We need to ignore order when diffing arrays, but don't want to sort each array first |
@wbish I am looking to implement this. Has there been any update (I understand it's been a long time) or progress I should be aware of? |
Hi,
Any chance you could add a detectMove parameter for array comparison, so reordered arrays with matching elements are not detected as a difference?
i.e. these two objects would match?
{'name':'John Doe','positions':[ 1, 2, 3 ] }
{'name':'John Doe','positions':[ 1, 3, 2 ] }
The text was updated successfully, but these errors were encountered: