npm

@propero/easy-filter
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Easy Filter

Maintainability Test Coverage

npm i @propero/easy-filter
# Or with yarn
yarn add @propero/easy-filter

Documentation

In progress... maybe... hopefully... within the next decade or so... no guarantees though

Examples

For further examples check out the example directory.

import { FilterParser, and, gt, eq } from "@propero/easy-filter";


const parser = new FilterParser();

const parsed = parser.parse("and(lt(age,18),like(firstName,A%))");
/*
{
  "op": "and",
  "filters": [{
    "op": "lt",
    "field": "age",
    "value": "18"
  },{
    "op": "like",
    "field": "firstName",
    "value": "A%"
  }]
}
*/
const serialized = parser.serialize(and(gt("age", "21"), eq("name", "Peter,()")));
// and(gt(age,21),eq(name,Peter\,\(\)))

Package Sidebar

Install

npm i @propero/easy-filter

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

13 MB

Total Files

53

Last publish

Collaborators

  • eyyy-nora
  • merlin_r
  • nschad