@antv/f2
Version:
Charts for mobile visualization.
21 lines • 429 B
JavaScript
export default function (callback, that) {
var node = this,
nodes = [node],
next = [],
children,
i,
n,
index = -1;
while (node = nodes.pop()) {
next.push(node);
if (children = node.children) {
for (i = 0, n = children.length; i < n; ++i) {
nodes.push(children[i]);
}
}
}
while (node = next.pop()) {
callback.call(that, node, ++index, this);
}
return this;
}