MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / parsePositiveInt

Function parsePositiveInt

packages/cli/src/commands/lambda.ts:431–438  ·  view source on GitHub ↗

* Parse a flag that must be a positive integer (>= 1) when supplied. * Negative values or non-integers fail loudly instead of flowing into * the SDK and producing opaque AWS validation errors mid-render.

(raw: unknown, flagName: string)

Source from the content-addressed store, hash-verified

429 * the SDK and producing opaque AWS validation errors mid-render.
430 */
431function parsePositiveInt(raw: unknown, flagName: string): number | undefined {
432 const n = parseIntFlag(raw);
433 if (n === undefined) return undefined;
434 if (!Number.isInteger(n) || n < 1) {
435 throw new Error(`[lambda] ${flagName} must be a positive integer; got ${n}`);
436 }
437 return n;
438}
439
440/**
441 * Parse a string-union flag against a closed set of allowed values.

Callers 1

runFunction · 0.70

Calls 1

parseIntFlagFunction · 0.70

Tested by

no test coverage detected