MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / compactQueryNodes

Function compactQueryNodes

scripts/integration/cli.mjs:1707–1732  ·  view source on GitHub ↗
(snapshot)

Source from the content-addressed store, hash-verified

1705}
1706
1707function compactQueryNodes(snapshot) {
1708 const nodes = [];
1709 const visit = (node) => {
1710 if (!node || typeof node !== "object") {
1711 return;
1712 }
1713 if (
1714 "role" in node ||
1715 "id" in node ||
1716 "label" in node ||
1717 "value" in node ||
1718 "frame" in node
1719 ) {
1720 nodes.push(node);
1721 }
1722 for (const child of Array.isArray(node.children) ? node.children : []) {
1723 visit(child);
1724 }
1725 };
1726 for (const match of Array.isArray(snapshot?.matches)
1727 ? snapshot.matches
1728 : []) {
1729 visit(match);
1730 }
1731 return nodes;
1732}
1733
1734function validFrame(frame) {
1735 return (

Callers 1

Calls 1

visitFunction · 0.70

Tested by

no test coverage detected