Skip to content

Commit

Permalink
fix(mathjs): updates mathjs to v7 from v3
Browse files Browse the repository at this point in the history
fixes #594
  • Loading branch information
2xAA committed Jun 25, 2021
1 parent ac63cbe commit a649a49
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/application/worker/store/modules/expressions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import math from "mathjs";
import uuidv4 from "uuid/v4";
const math = require("mathjs");

const state = {
assignments: {}
Expand All @@ -17,12 +17,14 @@ const getters = {
function compileExpression(expression) {
const scope = { value: 0, time: 0 };

console.log(math);

let newFunction;
try {
const node = math.parse(expression, scope);

newFunction = node.compile();
newFunction.eval(scope);
newFunction.evaluate(scope);
} catch (e) {
throw e;
}
Expand Down
2 changes: 1 addition & 1 deletion src/application/worker/store/modules/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ const actions = {
time: Date.now()
};

dataOut = expressionAssignment.func.eval(scope);
dataOut = expressionAssignment.func.evaluate(scope);
}

if (store.state.dataTypes[type] && store.state.dataTypes[type].create) {
Expand Down

0 comments on commit a649a49

Please sign in to comment.