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) //truelet ret2 = validateExpression(expression1, [1,2,3,4,5,6,7]) //truelet ret3 = validateExpression(expression1, [1,2,3,4,7]) //falselet ret4 = validateExpression(expression2) //false