8000 _.find result not consistent with Underscore.js · Issue #15 · lodash/lodash · GitHub
[go: up one dir, main page]

Skip to content

_.find result not consistent with Underscore.js #15

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

Closed
Guiswa opened this issue May 25, 2012 · 7 comments
Closed

_.find result not consistent with Underscore.js #15

Guiswa opened this issue May 25, 2012 · 7 comments

Comments

@Guiswa
Copy link
Guiswa commented May 25, 2012

See jsfiddle here: http://jsfiddle.net/Ln9xc/2/

Underscore.js behaves like so:

_([1,2,3,4]).find(function(i) { return i === 5 }); // returns undefined

While Lo-Dash returns the entire list if it can't find a match:

_([1,2,3,4]).find(function(i) { return i === 5 }); // returns [1,2,3,4]

This was unexpected for me. If this is desired behavior, perhaps add a note?

@jdalton
Copy link
Member
jdalton commented May 25, 2012

If this is desired behavior, perhaps add a note?

Nope, you found a bug and a lack of coverage in the Underscore unit tests. The documentation states it should return undefined. I will fix this and add the appropriate unit test. Thanks!

@KidkArolis
Copy link

When is this fix going to be pushed to the npm repo?

@jdalton
Copy link
Member
jdalton commented May 29, 2012

There is going to be a version bump tonight.

@mathiasbynens
Copy link
Contributor

There is going to be a version bump tonight.

That’s what your mom told me the other day.

@jdalton
Copy link
Member
jdalton commented May 29, 2012

There is going to be a version bump tonight.

That’s what your mom told me the other day.

They laughed...

@jdalton
Copy link
Member
jdalton commented May 30, 2012

@KidkArolis Updated!

jdalton added a commit that referenced this issue Sep 25, 2014
 #15]

Former-commit-id: e6dc89f98a1df81e1b1d67c5e8f5725e4df3bc5a
@lock
Copy link
lock bot commented Jan 19, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

4 participants
0