CODEBASE: Fix lint errors 2 (#1756)

This commit is contained in:
catloversg
2024-11-07 14:09:11 +07:00
committed by GitHub
parent e3c10e9f0f
commit 36c143b687
48 changed files with 267 additions and 146 deletions
+3 -3
View File
@@ -9,11 +9,11 @@ export function expr(args: (string | number | boolean)[]): void {
// Sanitize the math expression
const sanitizedExpr = expr.replace(/[^-()\d/*+.%]/g, "");
let result;
let result: string;
try {
result = eval?.(sanitizedExpr);
result = String(eval?.(sanitizedExpr));
} catch (e) {
Terminal.error(`Could not evaluate expression: ${sanitizedExpr}`);
Terminal.error(`Could not evaluate expression: ${sanitizedExpr}. Error: ${e}.`);
return;
}
Terminal.print(result);