MCPcopy Index your code
hub / github.com/Moddable-OpenSource/moddable / getNodes

Function getNodes

tools/mcdevicetree.js:372–392  ·  view source on GitHub ↗
(state, dts, kind)

Source from the content-addressed store, hash-verified

370}
371
372function getNodes(state, dts, kind) {
373 const compatibles = state.compatible.get(kind);
374 if (!compatibles)
375 return [];
376
377 return DTSParser.filter(dts, node => {
378 const compatible = node.properties?.compatible;
379 if (!compatible)
380 return;
381
382 const status = node.properties.status?.value?.value ?? "okay"
383 if ("okay" !== status)
384 return;
385
386 if ("string" === compatible.value.type)
387 return compatibles.includes(compatible.value.value);
388
389 if ("string-array" === compatible.value.type)
390 return compatible.value.value.some(value => compatibles.includes(value));
391 });
392}
393
394function doAliases(state, dts) {
395 const root = dts.nodes['/'];

Callers 2

doGPIOBanksFunction · 0.85
doBusFunction · 0.85

Calls 2

getMethod · 0.65
filterMethod · 0.45

Tested by

no test coverage detected