MCPcopy Create free account
hub / github.com/denoland/std / findElement

Function findElement

xml/_parse_sync_test.ts:1436–1448  ·  view source on GitHub ↗
(
    children: readonly import("./types.ts").XmlNode[],
    name: string,
  )

Source from the content-addressed store, hash-verified

1434
1435 // Find the ns:elem elements and check their URIs
1436 function findElement(
1437 children: readonly import("./types.ts").XmlNode[],
1438 name: string,
1439 ): import("./types.ts").XmlElement | undefined {
1440 for (const child of children) {
1441 if (child.type === "element") {
1442 if (child.name.local === name) return child;
1443 const found = findElement(child.children, name);
1444 if (found) return found;
1445 }
1446 }
1447 return undefined;
1448 }
1449
1450 const elem1 = findElement(doc.root.children, "elem1");
1451 const elem2 = findElement(doc.root.children, "elem2");

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected