(group, depth)
| 164 | // Large group of same-role siblings → first N + placeholder line + last N. |
| 165 | // Returns mix of AriaNode (to render) and pre-rendered placeholder strings. |
| 166 | function collapseGroup(group, depth) { |
| 167 | if (group.length <= SIBLING_COLLAPSE_THRESHOLD) return group |
| 168 | const keep = SIBLING_COLLAPSE_KEEP_EACH_SIDE |
| 169 | const omitted = group.length - keep * 2 |
| 170 | const placeholder = `${' '.repeat(depth)}- ...${omitted} similar "${group[0].role}" items omitted...` |
| 171 | return [...group.slice(0, keep), placeholder, ...group.slice(-keep)] |
| 172 | } |
| 173 | |
| 174 | function renderTree(nodes, depth = 0) { |
| 175 | const items = groupByConsecutiveRole(nodes).flatMap(group => collapseGroup(group, depth)) |
no outgoing calls
no test coverage detected
searching dependent graphs…