1.0.3 • Published 6 years ago
validate-expression v1.0.3
validate-expression
Install
$ npm install --save validate-expression
Usage
const { validateExpression } = require('validate-expression')
Example
const { validateExpression } = require('validate-expression')
let expression1 = '1&&2&3|4||5 & !(6|7)'
let expression2 = '1&&2&3|4||5! & !(6|7)'
let ret1 = validateExpression(expression1) //true
let ret2 = validateExpression(expression1, [1,2,3,4,5,6,7]) //true
let ret3 = validateExpression(expression1, [1,2,3,4,7]) //false
let ret4 = validateExpression(expression2) //false