MCPcopy Create free account
hub / github.com/modem-dev/hunk / parseNumberOption

Function parseNumberOption

scripts/daemon-memory-check.ts:56–67  ·  view source on GitHub ↗
(name: string, value: string | undefined)

Source from the content-addressed store, hash-verified

54};
55
56function parseNumberOption(name: string, value: string | undefined) {
57 if (value === undefined) {
58 throw new Error(`Missing value for ${name}.`);
59 }
60
61 const parsed = Number(value);
62 if (!Number.isFinite(parsed) || parsed < 0) {
63 throw new Error(`Expected ${name} to be a non-negative number.`);
64 }
65
66 return parsed;
67}
68
69/** Parse a small flag set without adding a runtime dependency to the memory harness. */
70function parseArgs(argv: string[]): CliOptions {

Callers 1

parseArgsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected