convert more user facing functions to unknown

This commit is contained in:
Olivier Gagnon
2022-03-16 19:50:56 -04:00
parent 989d0709ed
commit 28bd5e1b30
2 changed files with 36 additions and 17 deletions
+1
View File
@@ -435,6 +435,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
const x = parseFloat(v);
if (!isNaN(x)) return x; // otherwise it wasn't even a string representing a number.
} else if (typeof v === "number") {
if (isNaN(v)) throw makeRuntimeErrorMsg(funcName, `${argName} is NaN`);
return v;
}
throw makeRuntimeErrorMsg(funcName, `${argName} should be a number`);