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

Function instantiate

lib/test/angular/1.6.7/angular.js:5105–5113  ·  view source on GitHub ↗
(Type, locals, serviceName)

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 2

injectionArgsFunction · 0.70
isArrayFunction · 0.50

Tested by

no test coverage detected