boolex
v2.1.0
Published
Bool Expression
Downloads
57
Readme
Bool Expression
A DSL for Bool judge
BNF
E ::= E || E
E ::= E && E
E ::= !E
E ::= => E
E ::= e >= e
E ::= e <= e
E ::= e == e
E ::= e != e
E ::= e > e
E ::= e < e
E ::= e include e
e ::= '@'+xxx
e ::= number
e ::= 'string'
e ::= "string"
e ::= (E)
Usage
Install with npm:
$ npm install boolex --save
Script with boolex:
const boolex = require('boolex');
const expr = "@count >= 10";
const check = boolex.compile(expr);
var result = check({count: 10});
// => result is true
var result = check({count: 5});
// => result is false
Please see test cases for more usage details.
License
The MIT license