0.1.1 • Published 8 years ago

blow-filters v0.1.1

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

blow-filters

Codeship Status for mchmielarski/blow-filters

Builds filter function from JSON.

how to install

npm install --save blow-filters

how to use

import {filter} from 'blow-filters';

const data = [
  { title: 'title 1', price: 10},
  { title: 'title 2', price: 20},
  { title: 'title 3', price: 60}
];

data = data.filter(filter({price: {$lt: 60}));
console.log(data); 

output:

[{title: 'title 1', price: 10}, {title: 'title 2', price: 20}]

Operators

  • $eq - equal
  • $neq - not equal
  • $lt - less than
  • $lte - less than or equal
  • $gt - greater than
  • $gte - greater than or equal
  • $in - in array of values
  • $nin - not in array of values
  • $regex - regular expression
  • $or - logical operator OR

You can find more details how to use each operator in tests.