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

Each doesn't execute callbacks when wrapped #921

Closed
MikaAK opened this issue Feb 4, 2015 · 1 comment
Closed

Each doesn't execute callbacks when wrapped #921

MikaAK opened this issue Feb 4, 2015 · 1 comment
Labels

Comments

@MikaAK
Copy link

MikaAK commented Feb 4, 2015

I recently upgraded to v3.1.0 and i noticed that the each method has broken when using it via a lodash wrapper.

I also tested these in the console on the lodash website. Perhaps there's a change I'm unaware of but to break the functionality of each seems weird!

Not Working
_([1,2,4,5,6,9]).each(function(c) { 
  console.log('hi')
})

Working

_.each([1,2,4,5,6,9], function(c) { 
  console.log('hi')
})
@jdalton
Copy link
Member

jdalton commented Feb 4, 2015

Please read the changelog for a rundown of the breaking changes.

Chaining is now deferred until an implicit or explicit value() is requested. The _.each method returns the provided collection so does not warrant an implicit value() call.

// working
_([1,2,4,5,6,9]).each(function(c) {  console.log('hi') }).value();

The documentation for _.each has also been updated to reflect this.
Related to #785, #877, #878, #907, #960, #1017.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

2 participants