( count: number, singular: string, formatter?: (count: number, noun: string) => string, )
| 143 | * @returns The formatted description string, or `""` when `count` is falsy. |
| 144 | */ |
| 145 | export function formatMetricDescription( |
| 146 | count: number, |
| 147 | singular: string, |
| 148 | formatter?: (count: number, noun: string) => string, |
| 149 | ) { |
| 150 | if (!count) { |
| 151 | return ''; |
| 152 | } |
| 153 | |
| 154 | const noun = count === 1 ? singular : `${singular}s`; |
| 155 | |
| 156 | return formatter ? formatter(count, noun) : `${count} ${noun}`; |
| 157 | } |
no outgoing calls
no test coverage detected