0.0.1 • Published 3 years ago
@expateo/conditions-antlr-parser v0.0.1
Conditions ANTLR parser
A query language that allows to evaluate conditions.
Compilation
antlr4 -Dlanguage=JavaScript -no-listener -o generated -visitor -Xexact-output-dir src/Query.g4
API
parse({ input, data })
- input
<string> - data
<Object> - Returns:
<boolean | null>
The parse method determines if input with data is truthy or falsy. It returns null if input is not a valid condition according to the grammar.
validate({ input })
- input
<string> - Returns:
<boolean>
The validate method determines if input is a valid condition according to the grammar.
Usage
const input = `EXPR1 > 180 && EXPR2 = 'foo'`;
const data = {
EXPR1: "180",
EXPR2: "foo"
};
const result = parse({ input, data });Release Process
Pre-Commit Hooks
The following is to be done in the root directory
Hooks are installed when running make install_git_hooks.
0.0.1
3 years ago