toIdent() — astro Function Reference
Architecture documentation for the toIdent() function in index.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 98a90619_5f07_3f07_2127_1bc79b52e32b["toIdent()"] 9151bb3d_ee1e_da42_752a_45a9db1dd918["index.ts"] 98a90619_5f07_3f07_2127_1bc79b52e32b -->|defined in| 9151bb3d_ee1e_da42_752a_45a9db1dd918 07b08a43_b086_cd40_27c8_a3517efced2a["addIntegration()"] 07b08a43_b086_cd40_27c8_a3517efced2a -->|calls| 98a90619_5f07_3f07_2127_1bc79b52e32b baa08624_1acd_75f1_ecfc_8d7091335a43["setAdapter()"] baa08624_1acd_75f1_ecfc_8d7091335a43 -->|calls| 98a90619_5f07_3f07_2127_1bc79b52e32b style 98a90619_5f07_3f07_2127_1bc79b52e32b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/cli/add/index.ts lines 551–565
const toIdent = (name: string) => {
const ident = name
.trim()
// Remove astro or (astrojs) prefix and suffix
.replace(/[-_./]?astro(?:js)?[-_.]?/g, '')
// drop .js suffix
.replace(/\.js/, '')
// convert to camel case
.replace(/[.\-_/]+([a-zA-Z])/g, (_, w) => w.toUpperCase())
// drop invalid first characters
.replace(/^[^a-zA-Z$_]+/, '')
// drop version or tag
.replace(/@.*$/, '');
return `${ident[0].toLowerCase()}${ident.slice(1)}`;
};
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does toIdent() do?
toIdent() is a function in the astro codebase, defined in packages/astro/src/cli/add/index.ts.
Where is toIdent() defined?
toIdent() is defined in packages/astro/src/cli/add/index.ts at line 551.
What calls toIdent()?
toIdent() is called by 2 function(s): addIntegration, setAdapter.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free