mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-23 06:32:26 +01:00
Ensure INetscriptHelper number function handles NaN
This commit is contained in:
parent
e9db656e13
commit
3b765b2865
@ -13,7 +13,6 @@ import { SourceFileFlags } from "../SourceFile/SourceFileFlags";
|
||||
|
||||
import { dialogBoxCreate } from "../ui/React/DialogBox";
|
||||
import { clearObject } from "../utils/helpers/clearObject";
|
||||
import { Router } from "../ui/GameRoot";
|
||||
|
||||
import { WHRNG } from "../Casino/RNG";
|
||||
|
||||
|
@ -432,8 +432,11 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
|
||||
throw makeRuntimeErrorMsg(funcName, `${argName} should be a string`);
|
||||
},
|
||||
number: (funcName: string, argName: string, v: any): number => {
|
||||
if (typeof v === "number") return v;
|
||||
if (!isNaN(v) && !isNaN(parseFloat(v))) return parseFloat(v);
|
||||
if (!isNaN(v))
|
||||
{
|
||||
if (typeof v === "number") return v;
|
||||
if (!isNaN(parseFloat(v))) return parseFloat(v);
|
||||
}
|
||||
throw makeRuntimeErrorMsg(funcName, `${argName} should be a number`);
|
||||
},
|
||||
boolean: (v: any): boolean => {
|
||||
|
Loading…
Reference in New Issue
Block a user