MCPcopy Create free account
hub / github.com/EricSimons/ionic-course / bind

Function bind

code/songhop/www/lib/angular/angular.js:982–1000  ·  view source on GitHub ↗
(self, fn)

Source from the content-addressed store, hash-verified

980 */
981/* jshint +W101 */
982function bind(self, fn) {
983 var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : [];
984 if (isFunction(fn) && !(fn instanceof RegExp)) {
985 return curryArgs.length
986 ? function() {
987 return arguments.length
988 ? fn.apply(self, concat(curryArgs, arguments, 0))
989 : fn.apply(self, curryArgs);
990 }
991 : function() {
992 return arguments.length
993 ? fn.apply(self, arguments)
994 : fn.call(self);
995 };
996 } else {
997 // in IE, native methods are not functions so they cannot be bound (note: they don't need to be)
998 return fn;
999 }
1000}
1001
1002
1003function toJsonReplacer(key, value) {

Callers 1

getterFunction · 0.70

Calls 3

sliceArgsFunction · 0.70
isFunctionFunction · 0.70
concatFunction · 0.70

Tested by

no test coverage detected