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

Function groupByConsecutiveRole

lib/aria.js:152–162  ·  view source on GitHub ↗
(nodes)

Source from the content-addressed store, hash-verified

150
151// Group consecutive same-role siblings. [a,a,b,a,a,a] → [[a,a],[b],[a,a,a]]
152function groupByConsecutiveRole(nodes) {
153 return nodes.reduce((groups, node) => {
154 const last = groups[groups.length - 1]
155 if (last && last[0].role === node.role) {
156 last.push(node)
157 return groups
158 }
159 groups.push([node])
160 return groups
161 }, [])
162}
163
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.

Callers 1

renderTreeFunction · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected