MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / intParam

Function intParam

src/ui-server/api/respond.ts:159–176  ·  view source on GitHub ↗
(
  query: URLSearchParams,
  name: string,
  opts: { min: number; max: number; default?: number }
)

Source from the content-addressed store, hash-verified

157 * with line 200 would hide that.
158 */
159export function intParam(
160 query: URLSearchParams,
161 name: string,
162 opts: { min: number; max: number; default?: number }
163): number {
164 const raw = query.get(name);
165 if (raw === null || raw.trim() === '') {
166 if (opts.default !== undefined) return opts.default;
167 throw badRequest(`Missing required parameter "${name}".`);
168 }
169 const value = Number(raw);
170 if (!Number.isInteger(value) || value < opts.min || value > opts.max) {
171 throw badRequest(
172 `Parameter "${name}" must be a whole number between ${opts.min} and ${opts.max} (got "${raw}").`
173 );
174 }
175 return value;
176}
177
178/**
179 * Free-form text input, bounded.

Callers 7

buildFlowFunction · 0.90
buildSourceFunction · 0.90
parseDeadCodeQueryFunction · 0.90
buildSearchFunction · 0.90
buildStepsFunction · 0.90
buildEntryPointsFunction · 0.90
buildRoutesFunction · 0.90

Calls 3

badRequestFunction · 0.85
NumberInterface · 0.85
getMethod · 0.65

Tested by

no test coverage detected