| 33 | |
| 34 | /** The one-line summary above the list. */ |
| 35 | export function deadCodeHeadline(payload: WireDeadCode | null): string { |
| 36 | if (!payload) return ''; |
| 37 | const { rows } = payload; |
| 38 | if (rows.total === 0) return 'Nothing on this list.'; |
| 39 | const lines = payload.groups.reduce((sum, group) => sum + group.lines, 0); |
| 40 | const shown = rows.truncated |
| 41 | ? `${rows.shown} of ${rows.total} ${noun(rows.total, 'symbol')}` |
| 42 | : plural(rows.total, 'symbol'); |
| 43 | return `${shown} in ${plural(payload.groups.length, 'file')} · ${plural(lines, 'line')}`; |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * "2 478 of 2 498 candidates were left off" — the number that gives the list |