allowing bind with undefined contexts, but with arguments

This commit is contained in:
Jeremy Ashkenas
2009-11-07 23:17:27 -05:00
parent b5920e94a3
commit ef35fe1d86

View File

@@ -308,7 +308,7 @@
// Create a function bound to a given object (assigning 'this', and arguments,
// optionally). Binding with arguments is also known as 'curry'.
_.bind = function(func, context) {
if (!context) return func;
context = context || root;
var args = _.toArray(arguments).slice(2);
return function() {
var a = args.concat(_.toArray(arguments));