Home / Function/ replaceOrKeep() — astro Function Reference

replaceOrKeep() — astro Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  90f88b4e_4baf_d6d3_95c6_44a6828c3fbc["replaceOrKeep()"]
  a7eed989_9f2b_5163_ecdf_85920a8b973f["create.ts"]
  90f88b4e_4baf_d6d3_95c6_44a6828c3fbc -->|defined in| a7eed989_9f2b_5163_ecdf_85920a8b973f
  980f5a1b_85ee_0217_7a04_888abfb8f70f["createRoutesList()"]
  980f5a1b_85ee_0217_7a04_888abfb8f70f -->|calls| 90f88b4e_4baf_d6d3_95c6_44a6828c3fbc
  style 90f88b4e_4baf_d6d3_95c6_44a6828c3fbc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/core/routing/manifest/create.ts lines 806–809

function replaceOrKeep(original: string, from: string, to: string): string {
	if (original.startsWith(`/${to}/`) || original === `/${to}`) return original;
	return original.replace(`/${from}/`, `/${to}/`).replace(`/${from}`, `/${to}`);
}

Domain

Subdomains

Called By

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free