If you use bower.
bower install pg-formula-parser
If you use npm.
npm install pg-formula-parser
var formulaObject = null;
// Formula Parsing
var parsing = formulaObject = new FormulaParser('{expression}');
// Formula Unparsing
var unparsing = new FormulaParser(formulaObject.data);
// Formula Validation
var formula = new FormulaParser('{Some invalid expression}');
var isValid = formula.status === true;
// true = Validated, false = Syntax Error.
console.log(isValid);