Filtrex: A simple JavaScript filter expression compiler
github.com
github.com
var expression = compileExpression('transactions <= 5 and abs(profit) > 20.5');
...should also be possible to write as this, to help DRY everything... var fewTransactions = compileExpression('transactions <= 5');
var lotsOfProfit = compileExpression('abs(profit) > 20.5');
var expression = fewTransactions.and(lotsOfProfit);
You might look into the Specification pattern [0] to handle the heavy lifting in a simple way.I've implemented something similar several times in different ways now, and I strongly recommend looking into the Precedence Climbing algorithm - you can build something like this without the jison dependency in almost as few lines as `filtrex.js` already is.