* Where each level of a file's directory path ends, as indexes into `dirs`: a * level is one folder plus every pass-through folder that follows it.
(root: string, dirs: readonly string[], passThrough: ReadonlySet<string> | undefined)
| 264 | * level is one folder plus every pass-through folder that follows it. |
| 265 | */ |
| 266 | function levelEnds(root: string, dirs: readonly string[], passThrough: ReadonlySet<string> | undefined): number[] { |
| 267 | const ends: number[] = []; |
| 268 | for (let i = 0; i < dirs.length; ) { |
| 269 | i++; |
| 270 | while (passThrough && i < dirs.length && passThrough.has(joinPath(root, dirs.slice(0, i)))) i++; |
| 271 | ends.push(i); |
| 272 | } |
| 273 | return ends; |
| 274 | } |
| 275 | |
| 276 | function joinPath(root: string, segments: readonly string[]): string { |
| 277 | return [root, ...segments].filter(Boolean).join('/'); |
no test coverage detected