1.1.0 • Published 8 years ago

rule-parser v1.1.0

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

Rule parser

A simple rule parser to parse expressions like this:

x = "abc" and (y > 10 or date <= 01/31/2017) and not z <> ""

Installation

$ npm install rule-parser --save

Usage

const rule = require('rule-parser');
const parser = new rule.Parser();
const expr = 'city = "cupertino" and date >= 01/01/2016 and date < 04/01/2016';
parser.parse(expr, { city: 'san francisco', date: new Date() }); // return false;
parser.parse(expr, { city: 'cupertino', date: new Date() }); // return true;

License

MIT. See LICENSE.

1.1.0

8 years ago

1.0.0

8 years ago