This module provides an interface to apply a sequence of filters to an object. It is a subclass of Array, so any array method can be used on it.
npm install object-filter-sequence
const Filters = require('object-filter-sequence')
const filters = new Filters()
filters.push(previous => {
const next = {}
next.key = previous.key.toUpperCase()
return next
})
filters.push(previous => {
const next = {}
next.key = previous.key.reverse()
return next
})
filters.process({ key: 'value' }) // { key: 'EULAV' }
This is the only unique method from the Array base class. It is used to apply the filters in the array to the provided object.