Home / Function/ get_component_name() — svelte Function Reference

get_component_name() — svelte Function Reference

Architecture documentation for the get_component_name() function in index.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  8736da33_45f1_9528_4158_909afb1025c8["get_component_name()"]
  4aa8a188_84d4_0274_ed83_cac0ab1d3572["index.js"]
  8736da33_45f1_9528_4158_909afb1025c8 -->|defined in| 4aa8a188_84d4_0274_ed83_cac0ab1d3572
  78a6ba9a_5003_f569_a638_76e4f1977809["analyze_component()"]
  78a6ba9a_5003_f569_a638_76e4f1977809 -->|calls| 8736da33_45f1_9528_4158_909afb1025c8
  style 8736da33_45f1_9528_4158_909afb1025c8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/compiler/phases/2-analyze/index.js lines 238–247

function get_component_name(filename) {
	const parts = filename.split(/[/\\]/);
	const basename = /** @type {string} */ (parts.pop());
	const last_dir = /** @type {string} */ (parts.at(-1));
	let name = basename.replace('.svelte', '');
	if (name === 'index' && last_dir && last_dir !== 'src') {
		name = last_dir;
	}
	return name[0].toUpperCase() + name.slice(1);
}

Domain

Subdomains

Frequently Asked Questions

What does get_component_name() do?
get_component_name() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/2-analyze/index.js.
Where is get_component_name() defined?
get_component_name() is defined in packages/svelte/src/compiler/phases/2-analyze/index.js at line 238.
What calls get_component_name()?
get_component_name() is called by 1 function(s): analyze_component.

Analyze Your Own Codebase

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

Try Supermodel Free