Skip to content

Commit

Permalink
Fixed malformed equation detection
Browse files Browse the repository at this point in the history
  • Loading branch information
quintindunn committed Oct 21, 2023
1 parent 16ed68b commit 7fd072c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions static/graphs/js/dva_graphs/dva_graphs.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ function checkInput(expr, is_condition=false) {
let parsed;

try {
// Test expression to make sure it is valid.
math.evaluate(["t=" + 0, expr])

// Return a function that takes `x` to evaluate the expr.
parsed = (x) => {return math.evaluate(["t=" + x, expr])[1]};
}
Expand Down

0 comments on commit 7fd072c

Please sign in to comment.