You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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().
At http://documentcloud.github.com/underscore/#chaining, it says:
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:
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!
The text was updated successfully, but these errors were encountered: