https://github.com/digitaledgeit/js-filter-chain
A simple filter chain for running multiple filters on an input value.
https://github.com/digitaledgeit/js-filter-chain
Last synced: about 19 hours ago
JSON representation
A simple filter chain for running multiple filters on an input value.
- Host: GitHub
- URL: https://github.com/digitaledgeit/js-filter-chain
- Owner: digitaledgeit
- Created: 2014-05-02T00:53:01.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2015-05-13T14:59:13.000Z (about 11 years ago)
- Last Synced: 2025-04-19T12:34:43.211Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 188 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# filter-chain
A simple filter chain for running multiple filters on an input value.
## Methods
### FilterChain([filters])
Create a new filter chain from an array of filter functions.
### .add(filter)
Add a filter function. Filter functions can be synchronous `function(value) { return value; }`, or asynchronous `function(value, cb) { cb(value); }`.
### .filter(value, callback)
Run each filter on the value and then call the callback with the filtered value.
## Example
See test/test.json