nodejs-logical-query
v0.0.8
Published
Module for work with logical expression
Downloads
3
Readme
nodejs-logical-query
Install and use
npm i nodejs-logical-query -S
where -S
- --save
/ -D
- --save-dev
In your code:
let ExpressionParser = require('nodejs-logical-query')
Example
Expression: A && !(B || C) || D && !E
Set operand to true/false and define logical query:
let A = true
let B = false
let C = true
let D = true
let E = false
let expressionObject = {
'OR': [
{'AND': [
A,
{'NOT' : {'OR': [B, C]}}
]},
{'AND': [D, {'NOT': E}]}
]
}
And get result:
let expressionParser = new ExpressionParser(expressionObject)
console.log(expressionParser.result) // true