@erikwatson/applyfilters
v1.0.1
Published
Apply a set of filter functions to a dataset
Downloads
2
Readme
applyFilters.js
This is simply a function that runs a list of filters against a list of something, returning the result.
const applyFilters = require('@erikwatson/applyfilters')
const data = [
{ name: 'Nobody', age: 22 },
{ name: 'Normal Name', age: 33 },
{ name: 'Weird Name': age: 44 }
]
const filters = [
x => x.age > 27,
x => x.age < 37
]
const result = applyFilters(data, filters)
// result: [
// { name: 'Normal Name', age: 33 }
// ]