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

_.union should produce correct result when passed a falsey array argument. #1188

Closed
jdalton opened this issue Jul 6, 2013 · 5 comments
Closed
Labels

Comments

@jdalton
Copy link
Contributor

jdalton commented Jul 6, 2013

_.union(null, [1,2,3]);

// => [null, 1, 2, 3]
// instead of
// => [1, 2, 3]

This can happen if you pass somthing like _.union(someString.match(...), others);.

jashkenas added a commit that referenced this issue Jul 7, 2013
@jashkenas
Copy link
Owner

It's undefined behavior, but sure. I'm not seeing this problem.

@jdalton
Copy link
Contributor Author

jdalton commented Jul 7, 2013

You're testing for the wrong result.
The correct result, and the result in v1.4.4, is [1, 2, 3] not [null, 1, 2, 3].

@jashkenas
Copy link
Owner

_.union([null, 1, 2, 3])
[null, 1, 2, 3]

... how exactly is that the wrong result?

@jdalton
Copy link
Contributor Author

jdalton commented Jul 7, 2013

The test should be for _.union(null, [1, 2, 3]) not _.union([null, 1, 2, 3]).
In v1.4.4 _.union(null, [1, 2, 3]) returned [1, 2, 3] which is correct, but in v1.5 it returns [null, 1, 2, 3] which is not.

@ghost
Copy link

ghost commented Jul 10, 2013

Ping. You still have not corrected your invalid test here.

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

No branches or pull requests

2 participants