nl_tokens: Loads the modules associated to each filter and returns an array of middlewares .
pl_tokens: function loadMiddlewareFilters ( filters ) { var result = [ ] , index , num = filters . length , filter , modulePath , middleware ; function startsWith ( string , searchString , position ) { position = position || 0 ; return string . indexOf ( searchString , position ) === position ; } for ( index = 0 ; index < num ; index ++ ) { filter = filters [ index ] ; // Check filter has required properties if ( ! <mask> . id ) { throw new InvalidConfiguration ( InvalidConfiguration . INVALID_FILTER_MESSAGE + " Filter at index " + index + " has no 'id' property." ) ; } if ( ! filter . path ) { throw new InvalidConfiguration ( InvalidConfiguration . INVALID_FILTER_MESSAGE + " Filter at index " + index + " has no 'path' property." ) ; } // Determine module path depending on if it must be loaded from 'filters' folder // or node modules. modulePath = filter . path ; if ( startsWith ( filter . path , "." ) ) { modulePath = path . join ( basePath , filter . path ) ; } // Load filter module and initialize middleware filter middleware = require ( modulePath ) . init ( filter . id , filter . config ) ; result . push ( { id : filter . id , path : modulePath , config : filter . config , middleware : middleware } ) ; } return result ; }