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

Function findElement

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

Source from the content-addressed store, hash-verified

1422
1423 // Find the ns:elem elements and check their URIs
1424 function findElement(
1425 children: readonly import("./types.ts").XmlNode[],
1426 name: string,
1427 ): import("./types.ts").XmlElement | undefined {
1428 for (const child of children) {
1429 if (child.type === "element") {
1430 if (child.name.local === name) return child;
1431 const found = findElement(child.children, name);
1432 if (found) return found;
1433 }
1434 }
1435 return undefined;
1436 }
1437
1438 const elem1 = findElement(doc.root.children, "elem1");
1439 const elem2 = findElement(doc.root.children, "elem2");

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected