MCPcopy Create free account
hub / github.com/angular-ui/ui-grid / instantiate

Function instantiate

lib/test/angular/1.7.0/angular.js:5101–5109  ·  view source on GitHub ↗
(Type, locals, serviceName)

Source from the content-addressed store, hash-verified

5099
5100
5101 function instantiate(Type, locals, serviceName) {
5102 // Check if Type is annotated and use just the given function at n-1 as parameter
5103 // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]);
5104 var ctor = (isArray(Type) ? Type[Type.length - 1] : Type);
5105 var args = injectionArgs(Type, locals, serviceName);
5106 // Empty object at position 0 is ignored for invocation with `new`, but required.
5107 args.unshift(null);
5108 return new (Function.prototype.bind.apply(ctor, args))();
5109 }
5110
5111
5112 return {

Callers 1

Calls 2

isArrayFunction · 0.70
injectionArgsFunction · 0.70

Tested by

no test coverage detected