lib/configuration.js
function loadResources(resources, providerIndex) {

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

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

    // Check resource has required properties
    if (!resource.id) {
      throw new InvalidConfiguration(
        InvalidConfiguration.INVALID_RESOURCE_MESSAGE
        + " Resource at index " + index + " on"
        + " provider at index " + providerIndex + " has no 'id' property."
      );
    }
    if (!resource.context) {
      throw new InvalidConfiguration(
        InvalidConfiguration.INVALID_RESOURCE_MESSAGE
        + " Resource at index " + index + " on"
        + " provider at index " + providerIndex + " has no 'context' property."
      );
    }

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

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

  return result;
}
function loadResources(resources, providerIndex) {

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

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

    // Check resource has required properties
    if (!resource.id) {
      throw new InvalidConfiguration(
        InvalidConfiguration.INVALID_RESOURCE_MESSAGE
        + " Resource at index " + index + " on"
        + " provider at index " + providerIndex + " has no 'id' property."
      );
    }
    if (!resource.context) {
      throw new InvalidConfiguration(
        InvalidConfiguration.INVALID_RESOURCE_MESSAGE
        + " Resource at index " + index + " on"
        + " provider at index " + providerIndex + " has no 'context' property."
      );
    }

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

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

  return result;
}
Load resources configuration loading its pre and postfilters modules.

@private
@param  {Array<object>} resources Array with resources configuration.
@param  {boolean} providerIndex Index of the provider within array of providers.
@returns {Array<object>} Array with resources configuration plus a middleware
object referencing the filter's module.