Files
blowfish/node_modules/d3-hierarchy/src/hierarchy/count.js
T
Nuno Coração 5fb4bd8083 config redirect
2023-01-29 22:30:24 +00:00

13 lines
263 B
JavaScript

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);
}