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

Function enforceRange

packages/cli/src/cloud/parsing.ts:66–80  ·  view source on GitHub ↗
(
  flag: string,
  raw: string,
  value: number,
  bounds: { min?: number; max?: number },
)

Source from the content-addressed store, hash-verified

64}
65
66function enforceRange(
67 flag: string,
68 raw: string,
69 value: number,
70 bounds: { min?: number; max?: number },
71): void {
72 if (bounds.min !== undefined && value < bounds.min) {
73 errorBox(`Invalid ${flag}`, `Got "${raw}". Minimum is ${bounds.min}.`);
74 process.exit(1);
75 }
76 if (bounds.max !== undefined && value > bounds.max) {
77 errorBox(`Invalid ${flag}`, `Got "${raw}". Maximum is ${bounds.max}.`);
78 process.exit(1);
79 }
80}
81
82/** Parse an enum-typed flag against a closed set of allowed values. */
83export function parseEnumFlag<T extends string>(

Callers 2

parseIntFlagFunction · 0.85
parseNumericFlagFunction · 0.85

Calls 1

errorBoxFunction · 0.85

Tested by

no test coverage detected