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