Home / Function/ reduce() — astro Function Reference

reduce() — astro Function Reference

Architecture documentation for the reduce() function in generate-routes-json.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  55fc1e94_7bfe_6a4d_6e4d_c4ae7e7158bb["reduce()"]
  55782c85_47d4_4354_44a2_7507d9d6dbee["PathTrie"]
  55fc1e94_7bfe_6a4d_6e4d_c4ae7e7158bb -->|defined in| 55782c85_47d4_4354_44a2_7507d9d6dbee
  298714b3_acee_7cfa_6509_a32cf6723cc8["reduceAllPaths()"]
  298714b3_acee_7cfa_6509_a32cf6723cc8 -->|calls| 55fc1e94_7bfe_6a4d_6e4d_c4ae7e7158bb
  style 55fc1e94_7bfe_6a4d_6e4d_c4ae7e7158bb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/integrations/cloudflare/src/utils/generate-routes-json.ts lines 138–152

	private reduce(compNode: TrieNode, node: TrieNode): void {
		if (node.hasWildcardChild || compNode.hasWildcardChild) return;

		for (const [segment, childNode] of node.children) {
			if (childNode.children.size === 0) continue;

			const compChildNode = compNode.children.get(segment);
			if (compChildNode === undefined) {
				childNode.hasWildcardChild = true;
				continue;
			}

			this.reduce(compChildNode, childNode);
		}
	}

Domain

Subdomains

Called By

Frequently Asked Questions

What does reduce() do?
reduce() is a function in the astro codebase, defined in packages/integrations/cloudflare/src/utils/generate-routes-json.ts.
Where is reduce() defined?
reduce() is defined in packages/integrations/cloudflare/src/utils/generate-routes-json.ts at line 138.
What calls reduce()?
reduce() is called by 1 function(s): reduceAllPaths.

Analyze Your Own Codebase

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

Try Supermodel Free