( id: string, parentOf: Map<string, string>, fileNodeId: string | undefined )
| 229 | } |
| 230 | |
| 231 | function depthOf( |
| 232 | id: string, |
| 233 | parentOf: Map<string, string>, |
| 234 | fileNodeId: string | undefined |
| 235 | ): number { |
| 236 | let depth = 0; |
| 237 | let current = id; |
| 238 | // Bounded by the number of links so a cyclic `contains` chain — which should |
| 239 | // be impossible, but is one bad index away — cannot spin here. |
| 240 | for (let guard = 0; guard < 32; guard++) { |
| 241 | const parent = parentOf.get(current); |
| 242 | if (!parent || parent === fileNodeId) return depth; |
| 243 | depth++; |
| 244 | current = parent; |
| 245 | } |
| 246 | return depth; |
| 247 | } |
| 248 | |
| 249 | /** Fold edges into one row per file at the far end, ordered by symbol count. */ |
| 250 | function groupByFile( |
no test coverage detected