mirror of
https://github.com/searxng/searxng.git
synced 2026-06-22 09:38:34 +02:00
* [fix] calculator: move math.parse inside try-catch (#6278) * build static --------- Co-authored-by: Ivan Gabaldon <igabaldon@inetol.net>
This commit is contained in:
@@ -77,9 +77,9 @@ export default class Calculator extends Plugin {
|
||||
|
||||
protected async run(): Promise<string | undefined> {
|
||||
const searchInput = getElement<HTMLInputElement>("q");
|
||||
const node = Calculator.math.parse(searchInput.value);
|
||||
|
||||
try {
|
||||
const node = Calculator.math.parse(searchInput.value);
|
||||
return `${node.toString()} = ${node.evaluate()}`;
|
||||
} catch {
|
||||
// not a compatible math expression
|
||||
|
||||
Reference in New Issue
Block a user