MCPcopy
hub / github.com/angular-ui/ui-router / invoke

Function invoke

test/angular/1.6/angular.js:5103–5122  ·  view source on GitHub ↗
(fn, self, locals, serviceName)

Source from the content-addressed store, hash-verified

5101 }
5102
5103 function invoke(fn, self, locals, serviceName) {
5104 if (typeof locals === 'string') {
5105 serviceName = locals;
5106 locals = null;
5107 }
5108
5109 var args = injectionArgs(fn, locals, serviceName);
5110 if (isArray(fn)) {
5111 fn = fn[fn.length - 1];
5112 }
5113
5114 if (!isClass(fn)) {
5115 // http://jsperf.com/angularjs-invoke-apply-vs-switch
5116 // #5388
5117 return fn.apply(self, args);
5118 } else {
5119 args.unshift(null);
5120 return new (Function.prototype.bind.apply(fn, args))();
5121 }
5122 }
5123
5124
5125 function instantiate(Type, locals, serviceName) {

Callers

nothing calls this directly

Calls 3

isArrayFunction · 0.85
injectionArgsFunction · 0.70
isClassFunction · 0.70

Tested by

no test coverage detected