(node, trace, opts)
| 293 | }; |
| 294 | |
| 295 | function countDescendants(node, trace, opts) { |
| 296 | var nChild = 0; |
| 297 | |
| 298 | var children = node.children; |
| 299 | if(children) { |
| 300 | var len = children.length; |
| 301 | |
| 302 | for(var i = 0; i < len; i++) { |
| 303 | nChild += countDescendants(children[i], trace, opts); |
| 304 | } |
| 305 | |
| 306 | if(opts.branches) nChild++; // count this branch |
| 307 | } else { |
| 308 | if(opts.leaves) nChild++; // count this leaf |
| 309 | } |
| 310 | |
| 311 | // save to the node |
| 312 | node.value = node.data.data.value = nChild; |
| 313 | |
| 314 | // save to the trace |
| 315 | if(!trace._values) trace._values = []; |
| 316 | trace._values[node.data.data.i] = nChild; |
| 317 | |
| 318 | return nChild; |
| 319 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…