UNPKG

@virtualstate/examples

Version:
22 lines 636 B
export async function* read(node, seen = new WeakSet()) { if (!node.children) return; // console.log("children", node); for await (const children of node.children) { // console.log("children", children); for (const child of children) { if (!seen.has(child)) { yield child; seen.add(child); } yield* read(child, seen); } } // console.log("done", node); } export async function readAllDrain(input) { for await (const node of read(input)) { // console.log({ node }); } } //# sourceMappingURL=read.js.map