Home / Function/ isSemanticallyEqualSegment() — astro Function Reference

isSemanticallyEqualSegment() — astro Function Reference

Architecture documentation for the isSemanticallyEqualSegment() function in create.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  b81576c5_5ca8_7f92_fc59_7489816844e2["isSemanticallyEqualSegment()"]
  a7eed989_9f2b_5163_ecdf_85920a8b973f["create.ts"]
  b81576c5_5ca8_7f92_fc59_7489816844e2 -->|defined in| a7eed989_9f2b_5163_ecdf_85920a8b973f
  6d3eab18_f149_cd0f_b9bf_e3324684390e["detectRouteCollision()"]
  6d3eab18_f149_cd0f_b9bf_e3324684390e -->|calls| b81576c5_5ca8_7f92_fc59_7489816844e2
  style b81576c5_5ca8_7f92_fc59_7489816844e2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/core/routing/manifest/create.ts lines 78–100

function isSemanticallyEqualSegment(segmentA: RoutePart[], segmentB: RoutePart[]) {
	if (segmentA.length !== segmentB.length) {
		return false;
	}

	for (const [index, partA] of segmentA.entries()) {
		// Safe to use the index of one segment for the other because the segments have the same length
		const partB = segmentB[index];

		if (partA.dynamic !== partB.dynamic || partA.spread !== partB.spread) {
			return false;
		}

		// Only compare the content on non-dynamic segments
		// `/[bar]` and `/[baz]` are effectively the same route,
		// only bound to a different path parameter.
		if (!partA.dynamic && partA.content !== partB.content) {
			return false;
		}
	}

	return true;
}

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free