Document return value of `_.defaults` #2625

philfreo opened this Issue Nov 9, 2016 · 1 comment


None yet

2 participants

philfreo commented Nov 9, 2016 edited

I understand that _.defaults modifies its first argument (object) and also returns that value. However the return value of this function is not documented on

It's nice to be able to rely on the return value, e.g. in Backbone this is done:

Wouldn't it make sense to document the return value so people can feel comfortable relying on this behavior?

EDIT: I suppose it is somewhat documented by the => line in the code sample there, however I would still propose just using the word "returns" in the description, like you do with other similar functions.


Yeah, technically the => notation indicates the return value. If you want to open a pull request to make the docs more explicit, I'd merge it.

@philfreo philfreo added a commit to philfreo/underscore that referenced this issue Dec 27, 2016
@philfreo philfreo Docs: more explicit return value of _.defaults; Closes #2625 616386f
@jashkenas jashkenas closed this in #2640 Dec 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment