Home / Function/ getParameter() — astro Function Reference

getParameter() — astro Function Reference

Architecture documentation for the getParameter() function in generator.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  762791f4_4c9b_ccc4_94a1_b02e59d4a7f3["getParameter()"]
  f66463aa_0743_20f2_0ef3_7ae29013020e["generator.ts"]
  762791f4_4c9b_ccc4_94a1_b02e59d4a7f3 -->|defined in| f66463aa_0743_20f2_0ef3_7ae29013020e
  7242b7d7_2c3a_ea6c_bba0_c245bbd1dd26["getSegment()"]
  7242b7d7_2c3a_ea6c_bba0_c245bbd1dd26 -->|calls| 762791f4_4c9b_ccc4_94a1_b02e59d4a7f3
  style 762791f4_4c9b_ccc4_94a1_b02e59d4a7f3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/core/routing/manifest/generator.ts lines 20–39

function getParameter(part: RoutePart, params: Record<string, string | number>): string | number {
	if (part.spread) {
		return params[part.content.slice(3)] || '';
	}

	if (part.dynamic) {
		if (!params[part.content]) {
			throw new TypeError(`Missing parameter: ${part.content}`);
		}

		return params[part.content];
	}

	return part.content
		.normalize()
		.replace(/\?/g, '%3F')
		.replace(/#/g, '%23')
		.replace(/%5B/g, '[')
		.replace(/%5D/g, ']');
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does getParameter() do?
getParameter() is a function in the astro codebase, defined in packages/astro/src/core/routing/manifest/generator.ts.
Where is getParameter() defined?
getParameter() is defined in packages/astro/src/core/routing/manifest/generator.ts at line 20.
What calls getParameter()?
getParameter() is called by 1 function(s): getSegment.

Analyze Your Own Codebase

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

Try Supermodel Free