source: node_modules/d3-hierarchy/src/hierarchy/count.js

Last change on this file was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago

Prototype 1.1

  • Property mode set to 100644
File size: 263 bytes
Line 
1function count(node) {
2 var sum = 0,
3 children = node.children,
4 i = children && children.length;
5 if (!i) sum = 1;
6 else while (--i >= 0) sum += children[i].value;
7 node.value = sum;
8}
9
10export default function() {
11 return this.eachAfter(count);
12}
Note: See TracBrowser for help on using the repository browser.