@marterrez/eval-expression
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -28,3 +28,7 @@ "use strict"; | ||
eval(exp, params = {}, { | ||
eval(exp, params = {}, opts = {}) { | ||
this.evalExp(exp, params, opts); | ||
} | ||
evalExp(exp, params, { | ||
throwError = false | ||
@@ -44,3 +48,2 @@ }) { | ||
} catch (e) { | ||
console.log('exp error: ', e); | ||
return null; | ||
@@ -47,0 +50,0 @@ } |
{ | ||
"name": "@marterrez/eval-expression", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Small lib that allows to eval a string containing javascript code. It allows you do inject helper functions when evaluating the expression", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -16,3 +16,7 @@ import * as lodash from 'lodash' | ||
eval (exp, params = {}, { throwError = false }) { | ||
eval (exp, params = {}, opts = {}) { | ||
this.evalExp(exp, params, opts) | ||
} | ||
evalExp (exp, params, { throwError = false }) { | ||
if (!exp || !exp.length || typeof exp !== 'string') return null | ||
@@ -32,3 +36,2 @@ | ||
} catch (e) { | ||
console.log('exp error: ', e) | ||
return null | ||
@@ -35,0 +38,0 @@ } |
4654
73