New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

mathflow

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mathflow - npm Package Compare versions

Package was removed
Sorry, it seems this package was removed from the registry
Comparing version
0.1.0
to
0.2.0
+24
-4
dist/index.cjs

@@ -32,2 +32,8 @@ 'use strict';

const DEFAULT_VALUE = 0;
const config = {
/**
* Number of digits after the decimal point (min - 0, max - 20)
*/
fractionDigits: 4
};

@@ -112,2 +118,5 @@ var TokenType = /* @__PURE__ */ ((TokenType2) => {

let id;
function roundOff(value) {
return Number.parseFloat(value.toFixed(config.fractionDigits));
}
function interpret(node, scope, solution, reset = false) {

@@ -130,2 +139,3 @@ if (reset) {

left = interpret(node.left, scope, solution);
left = roundOff(left);
const trackLeft = node.left?.type === TokenType.BinaryOperator || node.left?.type === TokenType.Keyword;

@@ -137,2 +147,3 @@ if (trackLeft) {

right = interpret(node.right, scope, solution);
right = roundOff(right);
const trackRight = node.right?.type === TokenType.BinaryOperator || node.right?.type === TokenType.Keyword;

@@ -162,2 +173,3 @@ if (trackRight) {

}
result = roundOff(result);
solution.push(`${result}`);

@@ -168,5 +180,7 @@ break;

result = interpret(node.argument, scope, solution);
result = roundOff(result);
solution.push(`#${++id}`);
solution.push(`(${node.name}(#${id}))`);
solution.push(`${node.name}(#${id})`);
result = KEYWORDS[node.name](result);
result = roundOff(result);
solution.push(`${result}`);

@@ -275,4 +289,9 @@ break;

tmp = str.replaceAll(/#\d/g, (m) => map[m]?.result || "");
box.unshift(tmp);
str = str.replaceAll(/#\d/g, (m) => map[m]?.expr || "");
str = str.replaceAll(
/#\d/g,
(m) => map[m]?.expr || map[m]?.result || ""
);
if (tmp !== str) {
box.unshift(tmp);
}
if (!str.includes("#")) {

@@ -289,3 +308,3 @@ box.unshift(str);

return solution.map((t) => {
return t.replaceAll("((", "(").replaceAll("))", ")");
return t.startsWith("(") ? t.slice(1, -1) : t;
});

@@ -328,2 +347,3 @@ }

exports.config = config;
exports.evaluate = evaluate;
/**
* Output configuration
*/
declare const config: {
/**
* Number of digits after the decimal point (min - 0, max - 20)
*/
fractionDigits: number;
};
/**
* Object to store useful data used during interpretation

@@ -18,2 +28,2 @@ */

export { evaluate };
export { config, evaluate };
/**
* Output configuration
*/
declare const config: {
/**
* Number of digits after the decimal point (min - 0, max - 20)
*/
fractionDigits: number;
};
/**
* Object to store useful data used during interpretation

@@ -18,2 +28,2 @@ */

export { evaluate };
export { config, evaluate };
/**
* Output configuration
*/
declare const config: {
/**
* Number of digits after the decimal point (min - 0, max - 20)
*/
fractionDigits: number;
};
/**
* Object to store useful data used during interpretation

@@ -18,2 +28,2 @@ */

export { evaluate };
export { config, evaluate };

@@ -30,2 +30,8 @@ function toRadians(deg) {

const DEFAULT_VALUE = 0;
const config = {
/**
* Number of digits after the decimal point (min - 0, max - 20)
*/
fractionDigits: 4
};

@@ -110,2 +116,5 @@ var TokenType = /* @__PURE__ */ ((TokenType2) => {

let id;
function roundOff(value) {
return Number.parseFloat(value.toFixed(config.fractionDigits));
}
function interpret(node, scope, solution, reset = false) {

@@ -128,2 +137,3 @@ if (reset) {

left = interpret(node.left, scope, solution);
left = roundOff(left);
const trackLeft = node.left?.type === TokenType.BinaryOperator || node.left?.type === TokenType.Keyword;

@@ -135,2 +145,3 @@ if (trackLeft) {

right = interpret(node.right, scope, solution);
right = roundOff(right);
const trackRight = node.right?.type === TokenType.BinaryOperator || node.right?.type === TokenType.Keyword;

@@ -160,2 +171,3 @@ if (trackRight) {

}
result = roundOff(result);
solution.push(`${result}`);

@@ -166,5 +178,7 @@ break;

result = interpret(node.argument, scope, solution);
result = roundOff(result);
solution.push(`#${++id}`);
solution.push(`(${node.name}(#${id}))`);
solution.push(`${node.name}(#${id})`);
result = KEYWORDS[node.name](result);
result = roundOff(result);
solution.push(`${result}`);

@@ -273,4 +287,9 @@ break;

tmp = str.replaceAll(/#\d/g, (m) => map[m]?.result || "");
box.unshift(tmp);
str = str.replaceAll(/#\d/g, (m) => map[m]?.expr || "");
str = str.replaceAll(
/#\d/g,
(m) => map[m]?.expr || map[m]?.result || ""
);
if (tmp !== str) {
box.unshift(tmp);
}
if (!str.includes("#")) {

@@ -287,3 +306,3 @@ box.unshift(str);

return solution.map((t) => {
return t.replaceAll("((", "(").replaceAll("))", ")");
return t.startsWith("(") ? t.slice(1, -1) : t;
});

@@ -326,2 +345,2 @@ }

export { evaluate };
export { config, evaluate };
+1
-1
{
"name": "mathflow",
"version": "0.1.0",
"version": "0.2.0",
"description": "A concise, expressive scripting language for mathematical calculations with standard functions.",

@@ -5,0 +5,0 @@ "type": "module",