Class SpazFilterChain
Defined in: spazfilterchain.js.
Constructor Attributes | Constructor Name and Description |
---|---|
SpazFilterChain(opts)
The SpazFilterChain is intended to create a chain of filters for processing some input. |
Method Attributes | Method Name and Description |
---|---|
addFilter(label, func, position)
add a filter to the chain |
|
getFilterIndex(label)
find the array index of a given filter |
|
Returns an array of all the labels of filters in the chain |
|
makeFilterFirst(label)
move the identified filter to the front of the chain |
|
makeFilterLast(label)
takes a filter label and moves that filter to last in the chain |
|
removes all filters in the chain |
|
process(input)
takes input and processes it through each filter in the chain, returning the final result |
|
processArray(input_array)
like process, but takes an array and processes each item through the filter chain |
|
removeFilter(label)
remove a filter from the chain |
SpazFilterChain(opts)
The SpazFilterChain is intended to create a chain of filters for processing some input. There are no restrictions on the type of input, but all filter functions must expect the same type of input, and return the same type of output All filter functions must be synchronous -- they need to take input and return the modified version
- Parameters:
- opts
addFilter(label, func, position)
add a filter to the chain
- Parameters:
- {string} label
- the label for this filter. REQUIRED
- {function} func
- the filter function. REQUIRED
- position
{Number|Boolean} getFilterIndex(label)
find the array index of a given filter
- Parameters:
- {string} label
- the label for a filter in the chain
- Returns:
- {Number|Boolean} the position of the filter, or FALSE if not found
makeFilterFirst(label)
move the identified filter to the front of the chain
- Parameters:
- {string} label
- the filter's label
makeFilterLast(label)
takes a filter label and moves that filter to last in the chain
- Parameters:
- {string} label
- the label for a filter in the chain
{Mixed} process(input)
takes input and processes it through each filter in the chain, returning the final result
- Parameters:
- {Mixed} input
- The input
- Returns:
- {Mixed} the output