Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

math-expression-evaluator

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

math-expression-evaluator - npm Package Compare versions

Comparing version 1.2.19 to 1.2.20

2

package.json
{
"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);
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc