Code coverage report for src/index.js

Statements: 89.09% (49 / 55)      Branches: 16.67% (1 / 6)      Functions: 68.75% (11 / 16)      Lines: 89.09% (49 / 55)      Ignored: none     

All files » src/ » index.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 1121               1   1   1   1   1   1   1   1   1               1 5 5     5 5       1 9 9       1 7     1 2   2     1           1       1   1 1   1 1 1   1   1   1   1   1   1   1   1   1   1   1       1 1 1 1 1 1 1        
System.register(['aurelia-metadata', './metadata', './container'], function (_export) {
  /**
   * A lightweight, extensible dependency injection container for JavaScript.
   *
   * @module dependency-injection
   */
  'use strict';
 
  var Decorators, Metadata, TransientRegistration, SingletonRegistration, FactoryActivator, emptyParameters;
 
  _export('autoinject', autoinject);
 
  _export('inject', inject);
 
  _export('registration', registration);
 
  _export('transient', transient);
 
  _export('singleton', singleton);
 
  _export('instanceActivator', instanceActivator);
 
  _export('factory', factory);
 
  function autoinject(target) {
    var deco = function deco(target) {
      target.inject = Reflect.getOwnMetadata(Metadata.paramTypes, target) || emptyParameters;
    };
 
    return target ? deco(target) : deco;
  }
 
  function inject() {
    for (var _len = arguments.length, rest = Array(_len), _key = 0; _key < _len; _key++) {
      rest[_key] = arguments[_key];
    }
 
    return function (target) {
      target.inject = rest;
    };
  }
 
  function registration(value) {
    return function (target) {
      Reflect.defineMetadata(Metadata.registration, value, target);
    };
  }
 
  function transient(key) {
    return registration(new TransientRegistration(key));
  }
 
  function singleton(keyOrRegisterInChild) {
    var registerInChild = arguments[1] === undefined ? false : arguments[1];
 
    return registration(new SingletonRegistration(keyOrRegisterInChild, registerInChild));
  }
 
  function instanceActivator(value) {
    return function (target) {
      Reflect.defineMetadata(Metadata.instanceActivator, value, target);
    };
  }
 
  function factory() {
    return instanceActivator(FactoryActivator.instance);
  }
 
  return {
    setters: [function (_aureliaMetadata) {
      Decorators = _aureliaMetadata.Decorators;
      Metadata = _aureliaMetadata.Metadata;
    }, function (_metadata) {
      TransientRegistration = _metadata.TransientRegistration;
      SingletonRegistration = _metadata.SingletonRegistration;
      FactoryActivator = _metadata.FactoryActivator;
 
      _export('TransientRegistration', _metadata.TransientRegistration);
 
      _export('SingletonRegistration', _metadata.SingletonRegistration);
 
      _export('Resolver', _metadata.Resolver);
 
      _export('Lazy', _metadata.Lazy);
 
      _export('All', _metadata.All);
 
      _export('Optional', _metadata.Optional);
 
      _export('Parent', _metadata.Parent);
 
      _export('ClassActivator', _metadata.ClassActivator);
 
      _export('FactoryActivator', _metadata.FactoryActivator);
    }, function (_container) {
      emptyParameters = _container.emptyParameters;
 
      _export('Container', _container.Container);
    }],
    execute: function () {
 
      Decorators.configure.simpleDecorator('autoinject', autoinject);
      Decorators.configure.parameterizedDecorator('inject', inject);
      Decorators.configure.parameterizedDecorator('registration', registration);
      Decorators.configure.parameterizedDecorator('transient', transient);
      Decorators.configure.parameterizedDecorator('singleton', singleton);
      Decorators.configure.parameterizedDecorator('instanceActivator', instanceActivator);
      Decorators.configure.parameterizedDecorator('factory', factory);
    }
  };
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9Vc2Vycy9FaXNlbmJlcmdFZmZlY3QvRG9jdW1lbnRzL0dpdEh1Yi9UaGUgRHVyYW5kYWwgUHJvamVjdC9hdXJlbGlhL2RlcGVuZGVuY3ktaW5qZWN0aW9uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O3dCQXNCZ0IsVUFBVTs7b0JBUVYsTUFBTTs7MEJBTU4sWUFBWTs7dUJBTVosU0FBUzs7dUJBSVQsU0F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