MCPcopy
hub / github.com/angular-ui/ui-grid / instantiate

Function instantiate

lib/test/angular/1.8.0/angular.js:5216–5224  ·  view source on GitHub ↗
(Type, locals, serviceName)

Source from the content-addressed store, hash-verified

5214
5215
5216 function instantiate(Type, locals, serviceName) {
5217 // Check if Type is annotated and use just the given function at n-1 as parameter
5218 // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]);
5219 var ctor = (isArray(Type) ? Type[Type.length - 1] : Type);
5220 var args = injectionArgs(Type, locals, serviceName);
5221 // Empty object at position 0 is ignored for invocation with `new`, but required.
5222 args.unshift(null);
5223 return new (Function.prototype.bind.apply(ctor, args))();
5224 }
5225
5226
5227 return {

Callers 1

Calls 2

isArrayFunction · 0.70
injectionArgsFunction · 0.70

Tested by

no test coverage detected