updated bind method to stop un-needed variable assignment when using native method.

This commit is contained in:
Adam Craven
2011-02-20 22:24:29 +01:00
parent 468160204d
commit b65d647de8

View File

@@ -409,8 +409,8 @@
// optionally). Binding with arguments is also known as `curry`.
// Delegates to **ECMAScript 5**'s native `Function.bind` if available.
_.bind = function(func, obj) {
var args = slice.call(arguments, 2);
if(nativeBind && func.bind === nativeBind) return FuncProto.bind.apply(func, slice.call(arguments, 1));
var args = slice.call(arguments, 2);
return function() {
return func.apply(obj || {}, args.concat(slice.call(arguments)));
};