MCPcopy
hub / github.com/BuilderIO/agent-native / parseLimit

Function parseLimit

packages/core/src/progress/routes.ts:25–30  ·  view source on GitHub ↗
(value: unknown, fallback = 50)

Source from the content-addressed store, hash-verified

23import { listRuns, getRun, deleteRun } from "./store.js";
24
25function parseLimit(value: unknown, fallback = 50): number {
26 if (typeof value !== "string" || value.length === 0) return fallback;
27 const n = Number(value);
28 if (!Number.isFinite(n) || n <= 0) return fallback;
29 return Math.min(Math.floor(n), 200);
30}
31
32async function resolveOwner(event: H3Event): Promise<string> {
33 const session = await getSession(event).catch(() => null);

Callers 1

createProgressHandlerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected