-
Notifications
You must be signed in to change notification settings - Fork 509
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: diffArrays gives wrong result on array of booleans #173
Comments
In addition to const a1 = [1,2,3]
const a2 = [1,0,3]
[ { count: 1, value: [ 1 ] },
{ count: 1, added: undefined, removed: true, value: [ 2 ] },
{ count: 1, value: [ 3 ] } ] const a1 = ['a','b','c']
const a2 = ['a','','c']
[ { count: 1, value: [ 'a' ] },
{ count: 1, added: undefined, removed: true, value: [ 'b' ] },
{ count: 1, value: [ 'c' ] } ] It looks like a result of Removing falsey values seems to contradict the description: diffs two arrays, comparing each item for strict equality (===) Does it make sense to override another method in arrayDiff.removeEmpty = function(value) {
return value;
}; @wvanderdeijl Are you interested to follow up on this or prefer that I go for it? |
I won't have time for this over the weekend or beginning next. So feel free to take a crack at it. Otherwise I could have a look late next week |
Thank you for quick reply. I submitted a pull request. Take is as appreciation, not impatience. When you do have time, am happy to get your thought about change to clone arrays in d5003de I wrote a test to confirm that if the input is arrays for which every item is equal, then the output Is the goal to avoid aliasing input to output, that is, provide value semantics like strings? If yes, then what do you think about
If no, then it seems like the very original code for both methods to return the value is okay. |
outputs
which is wrong! i'd expect something like
The text was updated successfully, but these errors were encountered: