trptk/lib/listHelpers.ts
2026-02-24 17:14:07 +01:00

16 lines
456 B
TypeScript

export const PAGE_SIZE = 24;
export function clampInt(value: string | undefined, fallback: number, min: number, max: number) {
const n = Number.parseInt(value ?? "", 10);
if (Number.isNaN(n)) return fallback;
return Math.min(Math.max(n, min), max);
}
export function normalizeQuery(q: string | undefined) {
const s = (q ?? "").trim();
return s.length ? s : "";
}
export function groqLikeParam(q: string) {
return q.replaceAll('"', '\\"');
}