The first `levels` levels of `dirs`, a chain of three or more folders written `first/…/last`.
(root: string, dirs: readonly string[], ends: readonly number[])
| 279 | |
| 280 | /** The first `levels` levels of `dirs`, a chain of three or more folders written `first/…/last`. */ |
| 281 | function levelLabel(root: string, dirs: readonly string[], ends: readonly number[]): string { |
| 282 | const out: string[] = root ? [root] : []; |
| 283 | let from = 0; |
| 284 | for (const end of ends) { |
| 285 | const chain = dirs.slice(from, end); |
| 286 | out.push(chain.length >= 3 ? `${chain[0]}/…/${chain[chain.length - 1]}` : chain.join('/')); |
| 287 | from = end; |
| 288 | } |
| 289 | return out.join('/'); |
| 290 | } |
| 291 | |
| 292 | /** |
| 293 | * Which module a file belongs to, or `null` when it is outside the root. |
no test coverage detected