gnip-rule-parser
v1.0.0
Published
Parse GNIP rules into an abstract syntax tree.
Downloads
4
Readme
gnip-rule-parser
Parse GNIP rules into an abstract syntax tree.
If you want to validate rules, I strongly suggest you use the validation API endpoint.
Getting Started
Installation
npm install --save gnip-rule-parser
Running The Tests
mocha
Usage
var parser = require( 'gnip-rule-parser' );
try
{
var ast = parser.parse( 'happy OR party' );
console.log( ast );
}
catch( err )
{
// Rule isn't valid
}
Output
[
{
name: 'boolean',
value: 'OR',
leftBranch:
{
name: 'keyword',
value: 'happy'
},
rightBranch:
{
name: 'keyword',
value: 'party'
}
}
]
License
MIT