math-expression-evaluator
Advanced tools
Comparing version 1.2.19 to 1.2.20
{ | ||
"name": "math-expression-evaluator", | ||
"version": "1.2.19", | ||
"version": "1.2.20", | ||
"description": "A flexible math expression evaluator", | ||
@@ -5,0 +5,0 @@ "main": "src/formula_evaluator.js", |
@@ -131,3 +131,3 @@ var Mexp = require('./math_function.js') | ||
// newAr is a specially designed data structure in which 1D array at location one of 2d array has all string with length 1 2 with 2 and so on | ||
// newAr is a specially designed data structure index of 1d array = length of tokens | ||
@@ -199,2 +199,3 @@ if (x < newAr.length) { // match to check if token is really huge and not existing | ||
for (x = (inpStr.length - i > (newAr.length - 2) ? newAr.length - 1 : inpStr.length - i); x > 0; x--) { | ||
if (newAr[x] === undefined) continue; | ||
for (y = 0; y < newAr[x].length; y++) { | ||
@@ -201,0 +202,0 @@ if (match(inpStr, newAr[x][y], i, x)) { |
@@ -205,4 +205,22 @@ // This test is for node JS | ||
assert.equal(a.eval("27nroot3"), 3); | ||
a.addToken([{ | ||
type:2, | ||
token:"nrootlongesttoken", | ||
show:"nrootlongesttoken", | ||
value:function(a,b){ | ||
return Math.pow(a, 1 / b); | ||
} | ||
}]) | ||
assert.equal(a.eval("27nrootlongesttoken3"), 3); | ||
a.addToken([{ | ||
type:2, | ||
token:"tokenwithnumber34", | ||
show:"tokenwithnumber34", | ||
value:function(a,b){ | ||
return a + b; | ||
} | ||
}]) | ||
assert.equal(a.eval("17tokenwithnumber347"), 24); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
65821
1664