MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / collapseGroup

Function collapseGroup

lib/aria.js:166–172  ·  view source on GitHub ↗
(group, depth)

Source from the content-addressed store, hash-verified

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.
166function 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
174function renderTree(nodes, depth = 0) {
175 const items = groupByConsecutiveRole(nodes).flatMap(group => collapseGroup(group, depth))

Callers 1

renderTreeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…