mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-16 06:18:42 +02:00
CLI: Allow using E notation in expr CLI (#2209)
This commit is contained in:
@@ -8,7 +8,7 @@ export function expr(args: (string | number | boolean)[]): void {
|
||||
const expr = args.join("");
|
||||
|
||||
// Sanitize the math expression
|
||||
const sanitizedExpr = expr.replace(/[^-()\d/*+.%]/g, "");
|
||||
const sanitizedExpr = expr.replace(/[^-()\deE/*+.%]/g, "");
|
||||
let result: string;
|
||||
try {
|
||||
result = String(eval?.(sanitizedExpr));
|
||||
|
||||
Reference in New Issue
Block a user