Home / Function/ joinPaths() — astro Function Reference

joinPaths() — astro Function Reference

Architecture documentation for the joinPaths() function in path.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  b2287e86_0107_ea7f_780b_5f92d155cf1a["joinPaths()"]
  f5377c99_3ce3_1abd_148f_93394ff5efe2["path.ts"]
  b2287e86_0107_ea7f_780b_5f92d155cf1a -->|defined in| f5377c99_3ce3_1abd_148f_93394ff5efe2
  f26aab43_54ca_4fc2_d0a7_84567625122d["removeTrailingForwardSlash()"]
  b2287e86_0107_ea7f_780b_5f92d155cf1a -->|calls| f26aab43_54ca_4fc2_d0a7_84567625122d
  2432efff_5e8d_27fe_9835_6354f118a0ce["removeLeadingForwardSlash()"]
  b2287e86_0107_ea7f_780b_5f92d155cf1a -->|calls| 2432efff_5e8d_27fe_9835_6354f118a0ce
  76420228_a888_d0b8_b938_a3fdb41e774c["trimSlashes()"]
  b2287e86_0107_ea7f_780b_5f92d155cf1a -->|calls| 76420228_a888_d0b8_b938_a3fdb41e774c
  style b2287e86_0107_ea7f_780b_5f92d155cf1a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/internal-helpers/src/path.ts lines 71–84

export function joinPaths(...paths: (string | undefined)[]) {
	return paths
		.filter(isString)
		.map((path, i) => {
			if (i === 0) {
				return removeTrailingForwardSlash(path);
			} else if (i === paths.length - 1) {
				return removeLeadingForwardSlash(path);
			} else {
				return trimSlashes(path);
			}
		})
		.join('/');
}

Domain

Subdomains

Frequently Asked Questions

What does joinPaths() do?
joinPaths() is a function in the astro codebase, defined in packages/internal-helpers/src/path.ts.
Where is joinPaths() defined?
joinPaths() is defined in packages/internal-helpers/src/path.ts at line 71.
What does joinPaths() call?
joinPaths() calls 3 function(s): removeLeadingForwardSlash, removeTrailingForwardSlash, trimSlashes.

Analyze Your Own Codebase

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

Try Supermodel Free