UNPKG

290 BJavaScriptView Raw
1module.exports = function(exp, data) {
2 /* eslint-disable no-new-func */
3 const fn = new Function('data', `with (data) { return ${exp} }`)
4 try {
5 return fn(data)
6 } catch (err) {
7 console.error(err.stack)
8 console.error(`Error when evaluating filter condition: ${exp}`)
9 }
10}