export function isDuration(val: unknown): boolean { return ( (typeof val === 'string' || typeof val === 'number') && // biome-ignore lint/suspicious/noAssignInExpressions: to reduce one line (val = Number(val)) >= 0 && (val as number) < Number.POSITIVE_INFINITY ); } export function isTruthy(val: unknown): boolean { return ( val === true || typeof val === 'number' || (typeof val === 'string' && val !== 'false') ); } export function parseRawHeaders(headerStr: string): Record { const headers: Record = {}; const tokens = headerStr.toLowerCase().replace(/\s+/g, '').split(','); for (const token of tokens) { const split = token.split('=', 2) as [string, string]; headers[split[0]] = split[1] ?? true; } return headers; }