Spaces:
Running
Running
File size: 479 Bytes
d189f56 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | import type { LeaderboardEntry } from '../types/benchmark';
export function hasEloInterval(
entry: LeaderboardEntry,
): entry is LeaderboardEntry & { eloLo: number; eloHi: number } {
return entry.eloLo !== null && entry.eloHi !== null && entry.eloHi > entry.eloLo;
}
export function formatEloInterval(entry: LeaderboardEntry, digits = 0): string | null {
return hasEloInterval(entry)
? `[${entry.eloLo.toFixed(digits)}, ${entry.eloHi.toFixed(digits)}]`
: null;
}
|