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

Function instantiate

test/angular/1.7/angular.js:5151–5159  ·  view source on GitHub ↗
(Type, locals, serviceName)

Source from the content-addressed store, hash-verified

5149
5150
5151 function instantiate(Type, locals, serviceName) {
5152 // Check if Type is annotated and use just the given function at n-1 as parameter
5153 // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]);
5154 var ctor = (isArray(Type) ? Type[Type.length - 1] : Type);
5155 var args = injectionArgs(Type, locals, serviceName);
5156 // Empty object at position 0 is ignored for invocation with `new`, but required.
5157 args.unshift(null);
5158 return new (Function.prototype.bind.apply(ctor, args))();
5159 }
5160
5161
5162 return {

Callers 1

Calls 2

isArrayFunction · 0.85
injectionArgsFunction · 0.70

Tested by

no test coverage detected