This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function bind(self, fn) { | |
// arguments added beyond the two(self and fn) - store to be used by the bound function later (1) | |
var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : []; | |
if (isFunction(fn) && !(fn instanceof RegExp)) { | |
return curryArgs.length | |
? function() { | |
return arguments.length | |
? fn.apply(self, concat(curryArgs, arguments, 0)) | |
: fn.apply(self, curryArgs); | |
} |