Package Exports
- filterion
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (filterion) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Filterion
An immutable data structure for filter criteria management.
Filterion data cannot be changed once created, leading to much simpler application development, no defensive copying, enabling advanced memoization and change detection techniques with simple logic. Persistent data structure presents a mutative API which does not update the data in-place, but instead always yields new updated data.
Filterion has a built-in API to work with query strings, allowing zero-effort URL manipulations.
Install
Install filterion using yarn or npm:
$ yarn add filterion
# or
$ npm i filterionUsage
Require it into any module and use natively:
import { Filterion } from 'filterion';
const filter = new Filterion()
.add('device', 'iPhone')
.add('price', 649);
console.log(filter.getPayload());
/*
{
device: { '=': [ 'iPhone' ] },
price: { '=': [ 649 ] }
}
*/Or leverage the query string api:
import { Filterion } from 'filterion';
const newQuery = new Filterion()
.fromQueryString('device=iPhone&price=649')
.remove('price')
.add('year', 2007)
.toQueryString();
console.log(newQuery);
/*
device=iPhone&year=2007
*/
API
// TODOKudos
Inspired by immutable.js, an immutable collections library for JavaScript.
License
MIT