File size: 263 Bytes
bc20498 |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
function count(node) {
var sum = 0,
children = node.children,
i = children && children.length;
if (!i) sum = 1;
else while (--i >= 0) sum += children[i].value;
node.value = sum;
}
export default function() {
return this.eachAfter(count);
}
|