mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-30 04:47:03 +02:00
IPVGO: Improve type checking and documentation (#2028)
This commit is contained in:
committed by
GitHub
parent
41c497161f
commit
70a083b34b
@@ -73,6 +73,7 @@ export const helpers = {
|
||||
positiveSafeInteger,
|
||||
positiveNumber,
|
||||
scriptArgs,
|
||||
boolean,
|
||||
runOptions,
|
||||
spawnOptions,
|
||||
argsToString,
|
||||
@@ -181,6 +182,14 @@ function scriptArgs(ctx: NetscriptContext, args: unknown) {
|
||||
return args;
|
||||
}
|
||||
|
||||
/** Converts the provided value for v to a boolean, throwing if it is not */
|
||||
function boolean(ctx: NetscriptContext, argName: string, v: unknown): boolean {
|
||||
if (typeof v !== "boolean") {
|
||||
throw errorMessage(ctx, `${argName} must be a boolean, was ${v}`, "TYPE");
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
function runOptions(ctx: NetscriptContext, threadOrOption: unknown): CompleteRunOptions {
|
||||
const result: CompleteRunOptions = {
|
||||
threads: 1 as PositiveInteger,
|
||||
|
||||
Reference in New Issue
Block a user