pivotql-compiler-javascript
v0.2.1
Published
Compile PivotQL ASTs to javascript filter function.
Downloads
12
Readme
PivotQL compiler for elasticsearch
Produces elastic search queries from PivoQL ASTs.
Install
npm install pivotql-compiler-javascript
Example
import {parse} from 'pivotql-parser-expression';
import {compile} from 'pivotql-compiler-javascript';
const query = '( height <= 20 or favorites.color == "green" ) and firstname in ["john", "doug"]';
const queryFn = compile(parse(query))
const objToTest = {
height: 18,
favorites: {
color: "green"
},
firstname: "john"
}
queryFn(objToTest) // -> true
More information
See main repository for more information.