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

Change to SameValueZero for comparisons #2453

Open
jdalton opened this issue Feb 29, 2016 · 1 comment
Open

Change to SameValueZero for comparisons #2453

jdalton opened this issue Feb 29, 2016 · 1 comment

Comments

@jdalton
Copy link
Contributor

jdalton commented Feb 29, 2016

Currently for comparisons in methods like difference, includes, indexOf, intersection, lastIndexOf,uniq, union a strict equality, === is used.

If this was tweaked a bit to SameValueZero, === + NaN matches, then it would allow for optimizations with Set and Map as well as cover the NaN match case.

Thoughts?

@jdalton
Copy link
Contributor Author

jdalton commented Feb 29, 2016

It would mean:

_.indexOf(['a', NaN, 'b'], NaN);
// => 1 instead of -1

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

No branches or pull requests

1 participant