lib/configuration.js
function loadProviders(providers) {

  var result = [],
      index,
      num = providers.length,
      provider,
      prefilters, postfilters, resources;

  for (index = 0; index < num; index++ ) {
    provider = providers[index];
    prefilters = [];
    postfilters = [];
    resources = [];

    // Check provider has required properties
    if (!provider.id) {
      throw new InvalidConfiguration(InvalidConfiguration.INVALID_PROVIDER_MESSAGE + " Provider at index " + index + " has no 'id' property.");
    }
    if (!provider.target) {
      throw new InvalidConfiguration(InvalidConfiguration.INVALID_PROVIDER_MESSAGE + " Provider at index " + index + " has no 'target' property.");
    }
    if (!provider.context) {
      throw new InvalidConfiguration(InvalidConfiguration.INVALID_PROVIDER_MESSAGE + " Provider at index " + index + " has no context' property.");
    }

    // Load provider's filters
    if (provider.prefilters) {
      prefilters = loadMiddlewareFilters(provider.prefilters);
    }
    if (provider.postfilters) {
      postfilters = loadMiddlewareFilters(provider.postfilters);
    }

    // Load provider's resources
    if (provider.resources) {
      resources = loadResources(provider.resources, index);
    }

    // Store provider information
    result.push({
      id: provider.id,
      context: provider.context,
      target: provider.target,
      prefilters: prefilters,
      postfilters: postfilters,
      resources: resources
    });
  }

  return result;
}
function loadProviders(providers) {

  var result = [],
      index,
      num = providers.length,
      provider,
      prefilters, postfilters, resources;

  for (index = 0; index < num; index++ ) {
    provider = providers[index];
    prefilters = [];
    postfilters = [];
    resources = [];

    // Check provider has required properties
    if (!provider.id) {
      throw new InvalidConfiguration(InvalidConfiguration.INVALID_PROVIDER_MESSAGE + " Provider at index " + index + " has no 'id' property.");
    }
    if (!provider.target) {
      throw new InvalidConfiguration(InvalidConfiguration.INVALID_PROVIDER_MESSAGE + " Provider at index " + index + " has no 'target' property.");
    }
    if (!provider.context) {
      throw new InvalidConfiguration(InvalidConfiguration.INVALID_PROVIDER_MESSAGE + " Provider at index " + index + " has no context' property.");
    }

    // Load provider's filters
    if (provider.prefilters) {
      prefilters = loadMiddlewareFilters(provider.prefilters);
    }
    if (provider.postfilters) {
      postfilters = loadMiddlewareFilters(provider.postfilters);
    }

    // Load provider's resources
    if (provider.resources) {
      resources = loadResources(provider.resources, index);
    }

    // Store provider information
    result.push({
      id: provider.id,
      context: provider.context,
      target: provider.target,
      prefilters: prefilters,
      postfilters: postfilters,
      resources: resources
    });
  }

  return result;
}
function loadProviders ( providers ) { var result = [ ] , index , num = providers . length , provider , prefilters , postfilters , resources ; for ( index = 0 ; index < num ; index ++ ) { provider = providers [ index ] ; prefilters = [ ] ; postfilters = [ ] ; resources = [ ] ; // Check provider has required properties if ( ! provider . id ) { throw new InvalidConfiguration ( InvalidConfiguration . INVALID_PROVIDER_MESSAGE + " Provider at index " + index + " has no 'id' property." ) ; } if ( ! provider . target ) { throw new InvalidConfiguration ( InvalidConfiguration . INVALID_PROVIDER_MESSAGE + " Provider at index " + index + " has no 'target' property." ) ; } if ( ! provider . context ) { throw new InvalidConfiguration ( InvalidConfiguration . INVALID_PROVIDER_MESSAGE + " Provider at index " + index + " has no context' property." ) ; } // Load provider's filters if ( provider . prefilters ) { prefilters = loadMiddlewareFilters ( provider . prefilters ) ; } if ( provider . postfilters ) { postfilters = loadMiddlewareFilters ( provider . postfilters ) ; } // Load provider's resources if ( provider . resources ) { resources = loadResources ( provider . resources , index ) ; } // Store provider information result . push ( { id : provider . id , context : provider . context , target : provider . target , prefilters : prefilters , postfilters : postfilters , resources : resources } ) ; } return result ; }
Load providers configuration loading its pre and postfilters modules.

@private
@param  {Array<object>} providers Array with providers configuration.
@returns {Array<object>} Array with provider's configuration plus a middleware
object referencing the filter's module.
Load providers configuration loading its pre and postfilters modules .