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

_.eq #2456

Open
jdalton opened this issue Mar 1, 2016 · 4 comments
Open

_.eq #2456

jdalton opened this issue Mar 1, 2016 · 4 comments

Comments

@jdalton
Copy link
Contributor

jdalton commented Mar 1, 2016

Related to and really depending on #2453:
An _.eq method to enable the SameValueZero comparison for composition.

@moredure
Copy link

Hello, @jdalton! Can you give an use case example for composition of this functions?

@jdalton
Copy link
Contributor Author

jdalton commented Mar 14, 2016

Sure thing. See lodash/blob/npm/eq.js for an implementation reference.

This method extracts the SameValueZero comparison which would be what methods like
_.indexOf, _.includes, _.difference, _.intersection, _.lastIndexOf, _.uniq, & _.union
use for value comparisons.

It can be used as a shallow _.isEqual (without the recursive comparison bit).

@moredure
Copy link

@jdalton, may I follow ECMA to implement SameValueZero functionality and why you doesn't like private method 'eq'?

@jdalton
Copy link
Contributor Author

jdalton commented Mar 14, 2016

may I follow ECMA to implement SameValueZero functionality

You can though it's just the long way around of basically === + NaN.
For reference here are the spec steps for ===.

why you doesn't like private method 'eq'

Private helpers and their names didn't factor into it.

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

3 participants