TypeScript 61.9%
HTML 37.2%
SQL 0.7%
1import { slugify } from '@rareindex/shared';23/** URL slug for an auction house name (`/auctions/house/<slug>`). Deterministic; no DB round-trip. */4export function houseSlug(name: string): string {5 return slugify(name.replace(/[’']/g, '')) || 'house';6}78/** Resolve a URL slug back to the house name known by the registry; null when nothing matches. */9export function resolveHouse<T extends { house: string }>(slug: string, houses: readonly T[]): T | null {10 const s = slug.trim().toLowerCase();11 return houses.find((h) => houseSlug(h.house) === s) ?? null;12}1314/** Ending-within presets exposed on /auctions (hours). */15export const ENDING_WINDOWS = [16 { id: '24h', label: '24 h', hours: 24 },17 { id: '72h', label: '72 h', hours: 72 },18 { id: '7d', label: '7 days', hours: 168 },19] as const;20export type EndingWindow = (typeof ENDING_WINDOWS)[number]['id'];2122export function endingHours(id: string | null | undefined): number | null {23 return ENDING_WINDOWS.find((w) => w.id === id)?.hours ?? null;24}25