��diff --git a/src/application/worker/store/modules/expressions.js b/src/application/worker/store/modules/expressions.js index 90099345..0cf1daa4 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 e4be765e..7e326c88 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) {