Skip to content

Instantly share code, notes, and snippets.

View ys-angular-bind
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);
}
You can’t perform that action at this time.