Skip to content

Conversation

@bishopZ
Copy link

@bishopZ bishopZ commented Jan 8, 2015

No description provided.

@megawac
Copy link
Collaborator

megawac commented Jan 8, 2015

Use flatten() as we do in omit and pick

So something like

function bindAll(obj) {
    var keys = flatten(arguments, false, false, 1);
    var index = keys.length;
    if (index < 1) throw new Error('bindAll must be passed function names');
    while (index--) {
      obj[keys[index]] = _.bind(obj[keys[index]], obj);
    }
    return obj;
};

Also add some tests svp 😺

@jridgewell jridgewell mentioned this pull request Mar 13, 2015
4 tasks
jridgewell added a commit to jridgewell/underscore that referenced this pull request Apr 3, 2015
@jridgewell
Copy link
Collaborator

Closing in favor of #2141.

@jridgewell jridgewell closed this Apr 3, 2015
jridgewell added a commit to jridgewell/underscore that referenced this pull request May 22, 2015
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

Successfully merging this pull request may close these issues.

3 participants