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

Lazy each should cause immediate evaluation #785

Closed
megawac opened this issue Nov 18, 2014 · 2 comments
Closed

Lazy each should cause immediate evaluation #785

megawac opened this issue Nov 18, 2014 · 2 comments

Comments

@megawac
Copy link
Contributor

megawac commented Nov 18, 2014

This should be evaluated immediately and not wait for a .value()

_.chain([1,2,3]).each(console.log.bind(console))
@bnjmnt4n
Copy link
Contributor

Lazy.js also causes each calls to be evaluated immediately, for comparison. However, I agree that you should add some docs about lazy chaining and deferred evaluation, especially for cases where you have iterated over an array/object, but object[key] !== value.

@jdalton
Copy link
Member

jdalton commented Nov 19, 2014

Lazy.js also causes each calls to be evaluated immediately, for comparison.

Yeah, I knew they did. What I dig about keeping them deferred and based on implicit and explicit value() is it gives devs control (as they can use chain(), over creating their own sequence of actions that they can later reuse (with a possible helper method like lift or as).

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

No branches or pull requests

3 participants