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

Clarify documentation regarding chaining and OO style #538

Closed
russelldavis opened this issue Apr 1, 2012 · 0 comments
Closed

Clarify documentation regarding chaining and OO style #538

russelldavis opened this issue Apr 1, 2012 · 0 comments

Comments

@russelldavis
Copy link

At http://documentcloud.github.com/underscore/#chaining, it says:

Using the object-oriented style allows you to chain together methods. Calling chain on a wrapped object will cause all future method calls to return wrapped objects as well.

Especially given the example above that in the documentation, it's easy to (mis)interpret that as meaning "_([1, 2, 3]).map(...) is equivalent to _.chain([1, 2, 3]).map(...) (which of course isn't true)

It might be clearer to leave out the "Using the object-oriented style" bit, since chaining can be done as both OO-style (_(x).chain()) and functional-style (_.chain(x))

Finally, it would be nice to clarify the "probably should" comment in the changelog for version 1.2.4:

You now can (and probably should) write _.chain(list) instead of _(list).chain().

Is that just a style issue, or is there something else to it? (See some confusion about the issue at http://stackoverflow.com/questions/9626512/what-is-the-preferred-way-of-chaining-underscore-js-functions)

Thanks!

jrburke pushed a commit to amdjs/underscore that referenced this issue Apr 9, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants