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

Allow _.bindAll to take arrays #2141

Merged
merged 1 commit into from
May 22, 2015
Merged

Conversation

jridgewell
Copy link
Collaborator

Closes #1996, supercedes #2005.

@akre54
Copy link
Collaborator

akre54 commented Apr 3, 2015

Remind me the advantage of this over varargs-style passing? What's the real-world use case? (#1996 (comment))

@jridgewell
Copy link
Collaborator Author

I see the biggest win as parity with the other object functions _.pick and _.omit (I've always considered _.bindAll an object function).

if (length <= 1) throw new Error('bindAll must be passed function names');
for (i = 1; i < length; i++) {
key = arguments[i];
var keys = flatten(arguments, false, false, 1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With #2140

_.bindAll = _.restParams(function(obj, params) {
   params = flatten(params);

@jashkenas
Copy link
Owner

Rebase for a clean merge?

@jridgewell
Copy link
Collaborator Author

Rebased.

jashkenas added a commit that referenced this pull request May 22, 2015
@jashkenas jashkenas merged commit 5c3470a into jashkenas:master May 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

can _.bindAll accept an array of function names
4 participants