MCPcopy Create free account
hub / github.com/bclinkinbeard/angular / instantiate

Function instantiate

test/fixtures/foo.js:3969–3980  ·  view source on GitHub ↗
(Type, locals)

Source from the content-addressed store, hash-verified

3967 }
3968
3969 function instantiate(Type, locals) {
3970 var Constructor = function() {},
3971 instance, returnedValue;
3972
3973 // Check if Type is annotated and use just the given function at n-1 as parameter
3974 // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]);
3975 Constructor.prototype = (isArray(Type) ? Type[Type.length - 1] : Type).prototype;
3976 instance = new Constructor();
3977 returnedValue = invoke(Type, instance, locals);
3978
3979 return isObject(returnedValue) || isFunction(returnedValue) ? returnedValue : instance;
3980 }
3981
3982 return {
3983 invoke: invoke,

Callers

nothing calls this directly

Calls 3

invokeFunction · 0.85
isObjectFunction · 0.85
isFunctionFunction · 0.85

Tested by

no test coverage detected