Skip to content
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

Case sensitivity and order while comparing values #29

Open
chetanmotamarri opened this issue Apr 3, 2019 · 2 comments
Open

Case sensitivity and order while comparing values #29

chetanmotamarri opened this issue Apr 3, 2019 · 2 comments

Comments

@chetanmotamarri
Copy link

chetanmotamarri commented Apr 3, 2019

  1. Is there any way in this library to ignore cases while comparing ?
  2. Also to ignore the order of values in array

Example: array1 = [ "Audi", "toyota", "merc"]; array2 = [ "toyota", "audi", "merc"];

output: It should treat both array1 and array2 as same (as they have same values in different order and different cases i.e. capital and lowercases)

@chetanmotamarri chetanmotamarri changed the title case sensitivity Case sensitivity and order while comparing values Apr 3, 2019
@chetanmotamarri
Copy link
Author

Any update on this one ?

@wbish
Copy link
Owner

wbish commented Apr 19, 2019

No, feel free to add these features and submit a PR. Unfortunately, I don't have time to work on these.

For the first one I think maybe the right approach would be to expose an comparer interface people can implement and pass into JsonDiffPatch -- that way we can support weird cases like (int)1 == (string)"1"

The second one exists in the original JsonDiffPatch library already and something we should definitely add. Search for "detectMove" in benjamine/jsondiffpatch (https://github.com/benjamine/jsondiffpatch/blob/0c4323e9bff23ae231f4bff231ceed4df2b48be5/src/filters/arrays.js#L192)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants