MCPcopy Create free account
hub / github.com/nodejs/node / constructor

Method constructor

deps/v8/tools/parse-processor.mjs:535–551  ·  view source on GitHub ↗
(funktions)

Source from the content-addressed store, hash-verified

533
534class 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());

Callers

nothing calls this directly

Calls 4

reduceMethod · 0.80
forEachMethod · 0.65
maxMethod · 0.45

Tested by

no test coverage detected