export function maxOrNull(value: Iterable): number | null { let max!: number; let found = false; for (const it of value) { if (found && it <= max) continue; max = it; found = true; } if (!found) return null; return max; }