mostUsed
The most used range in counts, the newest on a tie.
import { newestRangeFirst } from "#codebase/tcmts/cli/provided"; export function mostUsed(counts: Map<string, number>): string | undefined { return [...counts].sort((a, b) => b[1] - a[1] || newestRangeFirst(a[0], b[0]))[0]?.[0]; }