Is there any way to ignore array order when diffing?
See original GitHub issueSay I create a diff for these 2 arrays
var a1 = @"
{
"items": [
"one",
"two"
}";
var a2 = @"
{
"items": [
"two",
"one"
}";
Is there some way of causing the diff to recognise them as the same array, since they only differ in the items’ order?
I am using Simple mode for Array diffing
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:5
Top Results From Across the Web
Expect Arrays to be equal ignoring order
The object portion of this answer will not actually verify that the objects match, since it is only comparing the mapped arrays. You...
Read more >Diff JSON comparision by ignoring the order.
JSON diffs require array elements to be in the same order, which is why you are seeing this behavior. One way to do...
Read more >array_diff - Manual
array_diff provides a handy way of deleting array elements by their value, without having to unset it by key, through a lengthy foreach...
Read more >How do I compare two arrays in JavaScript?
Comparing two arrays in JavaScript using either the loose or strict equality operators ( == or === ) will most often result in...
Read more >Array.prototype.sort() - JavaScript - MDN Web Docs
The sort () method of Array instances sorts the elements of an array in place and returns the reference to the same array,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
+1
+1 😃