Container.js
/**
 * Dependency injection container module
 *
 * @module agna-disc
 */
Dependency injection container module
@module agna-disc
Dependency injection container module @module agna - disc
function Container(configuration) {
  if (!(this instanceof Container)) {
    return new Container(configuration);
  }
  if (!_.isPlainObject(configuration)) {
    throw new Error('Configuration must be an object!');
  }
  this.allowOverwrite = false;
  this.locator = { __locate: require };
  this.parent = void 0;
  var self = this;
  ['allowOverwrite', 'locator', 'parent'].forEach(function (property) {
    if (!_.isUndefined(configuration[property])) {
      self[property]= configuration[property];
      delete configuration[property];
    }
  });
  this.locator = require('./locator/LocatorFactory').factory(this.locator);
  if (_.isUndefined(this.locator) || !_.isFunction(this.locator.__locate)) {
    throw new Error('Invalid \'locator\' option!');
  }
  if (!_.isBoolean(this.allowOverwrite)) {
    throw new Error('\'allowOverwrite\' option should be boolean!');
  }
  if (!_.isUndefined(this.parent) && !(this.parent instanceof Container)) {
    throw new Error('\'parent\' option should be an instance of Container!');
  }
  this._initialize(configuration);
}
function Container ( configuration ) { if ( ! ( this instanceof Container ) ) { return new Container ( configuration ) ; } if ( ! _ . isPlainObject ( configuration ) ) { throw new Error ( 'Configuration must be an object!' ) ; } this . allowOverwrite = false ; this . locator = { __locate : require } ; this . parent = void 0 ; var self = this ; [ 'allowOverwrite' , 'locator' , 'parent' ] . forEach ( function ( property ) { if ( ! _ . isUndefined ( configuration [ property ] ) ) { self [ property ] = configuration [ property ] ; delete configuration [ property ] ; } } ) ; this . locator = require ( './locator/LocatorFactory' ) . factory ( this . locator ) ; if ( _ . isUndefined ( this . locator ) || ! _ . isFunction ( this . locator . __locate ) ) { throw new Error ( 'Invalid \'locator\' option!' ) ; } if ( ! _ . isBoolean ( this . allowOverwrite ) ) { throw new Error ( '\'allowOverwrite\' option should be boolean!' ) ; } if ( ! _ . isUndefined ( this . parent ) && ! ( this . parent instanceof Container ) ) { throw new Error ( '\'parent\' option should be an instance of Container!' ) ; } this . _initialize ( configuration ) ; }
Dependency injection container module
 @module agna-disc
Dependency injection container module @module agna - disc
// Defaulting // Creating the locator