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

Function countAccessibilityNodes

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

Source from the content-addressed store, hash-verified

1993}
1994
1995function countAccessibilityNodes(snapshot) {
1996 const roots = Array.isArray(snapshot?.roots) ? snapshot.roots : [];
1997 let count = 0;
1998 const visit = (node) => {
1999 if (!node || typeof node !== "object") {
2000 return;
2001 }
2002 count += 1;
2003 for (const child of Array.isArray(node.children) ? node.children : []) {
2004 visit(child);
2005 }
2006 };
2007 for (const root of roots) {
2008 visit(root);
2009 }
2010 return count;
2011}
2012
2013function assertJson(payload, label) {
2014 if (!payload || typeof payload !== "object") {

Callers 1

runRestControlsFunction · 0.85

Calls 1

visitFunction · 0.70

Tested by

no test coverage detected