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

Function compactQueryNodes

scripts/integration/js-api.mjs:474–497  ·  view source on GitHub ↗
(snapshot)

Source from the content-addressed store, hash-verified

472}
473
474function compactQueryNodes(snapshot) {
475 const nodes = [];
476 const visit = (node) => {
477 if (!node || typeof node !== "object") {
478 return;
479 }
480 if (
481 "role" in node ||
482 "id" in node ||
483 "label" in node ||
484 "value" in node ||
485 "frame" in node
486 ) {
487 nodes.push(node);
488 }
489 for (const child of Array.isArray(node.children) ? node.children : []) {
490 visit(child);
491 }
492 };
493 for (const match of Array.isArray(snapshot) ? snapshot : []) {
494 visit(match);
495 }
496 return nodes;
497}
498
499function validFrame(frame) {
500 return (

Callers 1

Calls 1

visitFunction · 0.70

Tested by

no test coverage detected