export default function*() { | |
var node = this, current, next = [node], children, i, n; | |
do { | |
current = next.reverse(), next = []; | |
while (node = current.pop()) { | |
yield node; | |
if (children = node.children) { | |
for (i = 0, n = children.length; i < n; ++i) { | |
next.push(children[i]); | |
} | |
} | |
} | |
} while (next.length); | |
} | |