mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 09:33:49 +01:00
Update src/Terminal/commands/expr.ts
Updated to ApamNapat's suggestion Co-authored-by: ApamNapat <ApamNapat@users.noreply.github.com>
This commit is contained in:
parent
bb6d90fb41
commit
9602dbda2e
@ -17,7 +17,7 @@ export function expr(
|
||||
const expr = args.join("");
|
||||
|
||||
// Sanitize the math expression
|
||||
const sanitizedExpr = expr.replace(/s+/g, "").replace(/[^-()\d*/+.\%]/g, "");
|
||||
const sanitizedExpr = expr.replace(/s+/g, "").replace(/[^-()\d/*+.%]/g, "");
|
||||
let result;
|
||||
try {
|
||||
result = eval(sanitizedExpr);
|
||||
|
Loading…
Reference in New Issue
Block a user