Immutable data structure for filter criteria management.
Install filterion
using yarn or npm:
$ yarn add filterion
# or
$ npm i filterion
Then require it into any module:
import { Filterion } from 'filterion';
const filter = new Filterion()
.add('device', 'iPhone')
.add('price', 100, '>')
.add('price', 200, '<');
console.log(filter.payload);
/*
{
device: { '=': [ 'iPhone' ] },
price: { '>': [ 100 ], '<': [ 200 ] }
}
*/