toValidName() — astro Function Reference
Architecture documentation for the toValidName() function in shared.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD b10b4f33_88d4_af5f_1adb_bff81cc55d1e["toValidName()"] a889965c_1012_004b_402e_d9c7a19cb67b["shared.ts"] b10b4f33_88d4_af5f_1adb_bff81cc55d1e -->|defined in| a889965c_1012_004b_402e_d9c7a19cb67b 686845eb_122f_03c7_e7ef_24cf750783f8["isValidName()"] b10b4f33_88d4_af5f_1adb_bff81cc55d1e -->|calls| 686845eb_122f_03c7_e7ef_24cf750783f8 style b10b4f33_88d4_af5f_1adb_bff81cc55d1e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/create-astro/src/actions/shared.ts lines 48–59
export function toValidName(projectName: string) {
if (isValidName(projectName)) return projectName;
return projectName
.trim()
.toLowerCase()
.replace(/\s+/g, '-')
.replace(/^[._]/, '')
.replace(/[^a-z\d\-~]+/g, '-')
.replace(/^-+/, '')
.replace(/-+$/, '');
}
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does toValidName() do?
toValidName() is a function in the astro codebase, defined in packages/create-astro/src/actions/shared.ts.
Where is toValidName() defined?
toValidName() is defined in packages/create-astro/src/actions/shared.ts at line 48.
What does toValidName() call?
toValidName() calls 1 function(s): isValidName.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free