MCPcopy Index your code
hub / github.com/angular-ui/ui-grid / createInternalInjector

Function createInternalInjector

lib/test/angular/1.6.7/angular.js:5025–5125  ·  view source on GitHub ↗
(cache, factory)

Source from the content-addressed store, hash-verified

5023 ////////////////////////////////////
5024
5025 function createInternalInjector(cache, factory) {
5026
5027 function getService(serviceName, caller) {
5028 if (cache.hasOwnProperty(serviceName)) {
5029 if (cache[serviceName] === INSTANTIATING) {
5030 throw $injectorMinErr('cdep', 'Circular dependency found: {0}',
5031 serviceName + ' <- ' + path.join(' <- '));
5032 }
5033 return cache[serviceName];
5034 } else {
5035 try {
5036 path.unshift(serviceName);
5037 cache[serviceName] = INSTANTIATING;
5038 cache[serviceName] = factory(serviceName, caller);
5039 return cache[serviceName];
5040 } catch (err) {
5041 if (cache[serviceName] === INSTANTIATING) {
5042 delete cache[serviceName];
5043 }
5044 throw err;
5045 } finally {
5046 path.shift();
5047 }
5048 }
5049 }
5050
5051
5052 function injectionArgs(fn, locals, serviceName) {
5053 var args = [],
5054 $inject = createInjector.$$annotate(fn, strictDi, serviceName);
5055
5056 for (var i = 0, length = $inject.length; i < length; i++) {
5057 var key = $inject[i];
5058 if (typeof key !== 'string') {
5059 throw $injectorMinErr('itkn',
5060 'Incorrect injection token! Expected service name as string, got {0}', key);
5061 }
5062 args.push(locals && locals.hasOwnProperty(key) ? locals[key] :
5063 getService(key, serviceName));
5064 }
5065 return args;
5066 }
5067
5068 function isClass(func) {
5069 // Support: IE 9-11 only
5070 // IE 9-11 do not support classes and IE9 leaks with the code below.
5071 if (msie || typeof func !== 'function') {
5072 return false;
5073 }
5074 var result = func.$$ngIsClass;
5075 if (!isBoolean(result)) {
5076 // Support: Edge 12-13 only
5077 // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/6156135/
5078 result = func.$$ngIsClass = /^(?:class\b|constructor\()/.test(stringifyFn(func));
5079 }
5080 return result;
5081 }
5082

Callers 1

createInjectorFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected