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

Function createInternalInjector

lib/test/angular/1.5.0/angular.js:4537–4632  ·  view source on GitHub ↗
(cache, factory)

Source from the content-addressed store, hash-verified

4535 ////////////////////////////////////
4536
4537 function createInternalInjector(cache, factory) {
4538
4539 function getService(serviceName, caller) {
4540 if (cache.hasOwnProperty(serviceName)) {
4541 if (cache[serviceName] === INSTANTIATING) {
4542 throw $injectorMinErr('cdep', 'Circular dependency found: {0}',
4543 serviceName + ' <- ' + path.join(' <- '));
4544 }
4545 return cache[serviceName];
4546 } else {
4547 try {
4548 path.unshift(serviceName);
4549 cache[serviceName] = INSTANTIATING;
4550 return cache[serviceName] = factory(serviceName, caller);
4551 } catch (err) {
4552 if (cache[serviceName] === INSTANTIATING) {
4553 delete cache[serviceName];
4554 }
4555 throw err;
4556 } finally {
4557 path.shift();
4558 }
4559 }
4560 }
4561
4562
4563 function injectionArgs(fn, locals, serviceName) {
4564 var args = [],
4565 $inject = createInjector.$$annotate(fn, strictDi, serviceName);
4566
4567 for (var i = 0, length = $inject.length; i < length; i++) {
4568 var key = $inject[i];
4569 if (typeof key !== 'string') {
4570 throw $injectorMinErr('itkn',
4571 'Incorrect injection token! Expected service name as string, got {0}', key);
4572 }
4573 args.push(locals && locals.hasOwnProperty(key) ? locals[key] :
4574 getService(key, serviceName));
4575 }
4576 return args;
4577 }
4578
4579 function isClass(func) {
4580 // IE 9-11 do not support classes and IE9 leaks with the code below.
4581 if (msie <= 11) {
4582 return false;
4583 }
4584 // Workaround for MS Edge.
4585 // Check https://connect.microsoft.com/IE/Feedback/Details/2211653
4586 return typeof func === 'function'
4587 && /^(?:class\s|constructor\()/.test(Function.prototype.toString.call(func));
4588 }
4589
4590 function invoke(fn, self, locals, serviceName) {
4591 if (typeof locals === 'string') {
4592 serviceName = locals;
4593 locals = null;
4594 }

Callers 1

createInjectorFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected