|
Last change
on this file since e4c61dd was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago |
|
Prototype 1.1
|
-
Property mode
set to
100644
|
|
File size:
263 bytes
|
| Line | |
|---|
| 1 | function 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 |
|
|---|
| 10 | export default function() {
|
|---|
| 11 | return this.eachAfter(count);
|
|---|
| 12 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.