(funktions)
| 533 | |
| 534 | class NestingDistribution { |
| 535 | constructor(funktions) { |
| 536 | // Stores the nof bytes per function nesting level. |
| 537 | this.accumulator = [0, 0, 0, 0, 0]; |
| 538 | // Max nof bytes encountered at any nesting level. |
| 539 | this.max = 0; |
| 540 | // avg bytes per nesting level. |
| 541 | this.avg = 0; |
| 542 | this.totalBytes = 0; |
| 543 | |
| 544 | funktions.forEach(each => each.accumulateNestingLevel(this.accumulator)); |
| 545 | this.max = this.accumulator.reduce((max, each) => Math.max(max, each), 0); |
| 546 | this.totalBytes = this.accumulator.reduce((sum, each) => sum + each, 0); |
| 547 | for (let i = 0; i < this.accumulator.length; i++) { |
| 548 | this.avg += this.accumulator[i] * i; |
| 549 | } |
| 550 | this.avg /= this.totalBytes; |
| 551 | } |
| 552 | |
| 553 | print() { |
| 554 | console.log(this.toString()); |
nothing calls this directly
no test coverage detected