1.0.1 • Published 6 years ago

@erikwatson/applyfilters v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

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 }
// ]

Author

1.0.1

6 years ago

1.0.0

6 years ago