export function unit( n: number, singular: string, plural: string, f: (n: number, unit: string) => string = format ): string { return n > 1 ? f(n, plural) : f(n, singular) } function format(n: number, unit: string): string { return `${n} ${unit}` }