lib/configuration.js
function load(config) {

  var configuration = {
    prefilters: [],
    providers: [],
    postfilters: []
  };

  // Check a valid object
  if (typeof config !== "object") {
    throw new InvalidConfiguration(InvalidConfiguration.EMPTY_MESSAGE);
  }

  // Check at least one provider
  if (!config.providers || !config.providers.length) {
    throw new InvalidConfiguration(InvalidConfiguration.NO_PROVIDER_MESSAGE);
  }

  // Load prefilters
  if (config.prefilters) {
    configuration.prefilters = loadMiddlewareFilters(config.prefilters);
  }

  // Load postfilters
  if (config.postfilters) {
    configuration.postfilters = loadMiddlewareFilters(config.postfilters);
  }

  // Load providers
  configuration.providers = loadProviders(config.providers);

  return configuration;
}
function load(config) {

  var configuration = {
    prefilters: [],
    providers: [],
    postfilters: []
  };

  // Check a valid object
  if (typeof config !== "object") {
    throw new InvalidConfiguration(InvalidConfiguration.EMPTY_MESSAGE);
  }

  // Check at least one provider
  if (!config.providers || !config.providers.length) {
    throw new InvalidConfiguration(InvalidConfiguration.NO_PROVIDER_MESSAGE);
  }

  // Load prefilters
  if (config.prefilters) {
    configuration.prefilters = loadMiddlewareFilters(config.prefilters);
  }

  // Load postfilters
  if (config.postfilters) {
    configuration.postfilters = loadMiddlewareFilters(config.postfilters);
  }

  // Load providers
  configuration.providers = loadProviders(config.providers);

  return configuration;
}
function load ( config ) { var configuration = { prefilters : [ ] , providers : [ ] , postfilters : [ ] } ; // Check a valid object if ( typeof config !== "object" ) { throw new InvalidConfiguration ( InvalidConfiguration . EMPTY_MESSAGE ) ; } // Check at least one provider if ( ! config . providers || ! config . providers . length ) { throw new InvalidConfiguration ( InvalidConfiguration . NO_PROVIDER_MESSAGE ) ; } // Load prefilters if ( config . prefilters ) { configuration . prefilters = loadMiddlewareFilters ( config . prefilters ) ; } // Load postfilters if ( config . postfilters ) { configuration . postfilters = loadMiddlewareFilters ( config . postfilters ) ; } // Load providers configuration . providers = loadProviders ( config . providers ) ; return configuration ; }
Load a configuration returning and object with prefilters, postfilters and
providers middlewares ready to be used.

@public
@param  {object} config JavaScript object with configuration
@returns {object} configuration with middlewares loaded.
Load a configuration returning and object with prefilters postfilters and providers middlewares ready to be used .