Home / Function/ calculateStat() — astro Function Reference

calculateStat() — astro Function Reference

Architecture documentation for the calculateStat() function in _util.js from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  726183f0_decf_6bca_ceb6_e7759e37fb91["calculateStat()"]
  4265c711_d908_961d_b7f8_d10af2c1c59b["_util.js"]
  726183f0_decf_6bca_ceb6_e7759e37fb91 -->|defined in| 4265c711_d908_961d_b7f8_d10af2c1c59b
  18a2b2ae_4c68_5978_d2cd_e2a17cf7702e["benchmarkCommand()"]
  18a2b2ae_4c68_5978_d2cd_e2a17cf7702e -->|calls| 726183f0_decf_6bca_ceb6_e7759e37fb91
  0a0d5ca9_b005_f655_c7a6_9a56ad9a11e6["benchmarkRenderTime()"]
  0a0d5ca9_b005_f655_c7a6_9a56ad9a11e6 -->|calls| 726183f0_decf_6bca_ceb6_e7759e37fb91
  style 726183f0_decf_6bca_ceb6_e7759e37fb91 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

benchmark/bench/_util.js lines 14–21

export function calculateStat(numbers) {
	const avg = numbers.reduce((a, b) => a + b, 0) / numbers.length;
	const stdev = Math.sqrt(
		numbers.map((x) => Math.pow(x - avg, 2)).reduce((a, b) => a + b, 0) / numbers.length,
	);
	const max = Math.max(...numbers);
	return { avg, stdev, max };
}

Subdomains

Frequently Asked Questions

What does calculateStat() do?
calculateStat() is a function in the astro codebase, defined in benchmark/bench/_util.js.
Where is calculateStat() defined?
calculateStat() is defined in benchmark/bench/_util.js at line 14.
What calls calculateStat()?
calculateStat() is called by 2 function(s): benchmarkCommand, benchmarkRenderTime.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free