MCPcopy Index your code
hub / github.com/angular-ui/ui-router / instantiate

Function instantiate

test/angular/1.5/angular.js:4779–4787  ·  view source on GitHub ↗
(Type, locals, serviceName)

Source from the content-addressed store, hash-verified

4777
4778
4779 function instantiate(Type, locals, serviceName) {
4780 // Check if Type is annotated and use just the given function at n-1 as parameter
4781 // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]);
4782 var ctor = (isArray(Type) ? Type[Type.length - 1] : Type);
4783 var args = injectionArgs(Type, locals, serviceName);
4784 // Empty object at position 0 is ignored for invocation with `new`, but required.
4785 args.unshift(null);
4786 return new (Function.prototype.bind.apply(ctor, args))();
4787 }
4788
4789
4790 return {

Callers 1

Calls 2

isArrayFunction · 0.85
injectionArgsFunction · 0.70

Tested by

no test coverage detected