From a649a492c29f1bda90ca9fca2a1208412db07fab Mon Sep 17 00:00:00 2001 From: Sam Wray Date: Fri, 25 Jun 2021 10:47:41 +0100 Subject: [PATCH 1/2] fix(mathjs): updates mathjs to v7 from v3 fixes #594 --- src/application/worker/store/modules/expressions.js | 6 ++++-- src/application/worker/store/modules/modules.js | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/application/worker/store/modules/expressions.js b/src/application/worker/store/modules/expressions.js index 90099345e..0cf1daa4f 100644 --- a/src/application/worker/store/modules/expressions.js +++ b/src/application/worker/store/modules/expressions.js @@ -1,5 +1,5 @@ -import math from "mathjs"; import uuidv4 from "uuid/v4"; +const math = require("mathjs"); const state = { assignments: {} @@ -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; } diff --git a/src/application/worker/store/modules/modules.js b/src/application/worker/store/modules/modules.js index e4be765e4..7e326c88e 100644 --- a/src/application/worker/store/modules/modules.js +++ b/src/application/worker/store/modules/modules.js @@ -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) { From a728c7a88b0533ac2b2a45995a252536a0fc4291 Mon Sep 17 00:00:00 2001 From: Tim Pietrusky Date: Fri, 25 Jun 2021 13:26:19 +0200 Subject: [PATCH 2/2] chore(mathjs): Remove console.log --- src/application/worker/store/modules/expressions.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/application/worker/store/modules/expressions.js b/src/application/worker/store/modules/expressions.js index 0cf1daa4f..001c3ddb8 100644 --- a/src/application/worker/store/modules/expressions.js +++ b/src/application/worker/store/modules/expressions.js @@ -17,8 +17,6 @@ const getters = { function compileExpression(expression) { const scope = { value: 0, time: 0 }; - console.log(math); - let newFunction; try { const node = math.parse(expression, scope);