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

Function parseNumberOption

benchmarks/navigation-memory.ts:50–61  ·  view source on GitHub ↗
(name: string, value: string | undefined)

Source from the content-addressed store, hash-verified

48};
49
50function parseNumberOption(name: string, value: string | undefined) {
51 if (value === undefined) {
52 throw new Error(`Missing value for ${name}.`);
53 }
54
55 const parsed = Number(value);
56 if (!Number.isFinite(parsed) || parsed < 0) {
57 throw new Error(`Expected ${name} to be a non-negative number.`);
58 }
59
60 return parsed;
61}
62
63/** Parse a small flag set without pulling benchmark-only dependencies into the app. */
64function parseArgs(argv: string[]): CliOptions {

Callers 1

parseArgsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected