Home / Function/ insert() — astro Function Reference

insert() — astro Function Reference

Architecture documentation for the insert() function in generate-routes-json.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  50db76a0_b0ab_7605_0653_203d0278f34d["insert()"]
  55782c85_47d4_4354_44a2_7507d9d6dbee["PathTrie"]
  50db76a0_b0ab_7605_0653_203d0278f34d -->|defined in| 55782c85_47d4_4354_44a2_7507d9d6dbee
  8640426d_7494_3130_6574_2a01f8ff809d["createRoutesFile()"]
  8640426d_7494_3130_6574_2a01f8ff809d -->|calls| 50db76a0_b0ab_7605_0653_203d0278f34d
  style 50db76a0_b0ab_7605_0653_203d0278f34d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/integrations/cloudflare/src/utils/generate-routes-json.ts lines 96–111

	insert(thisPath: string[]) {
		let node = this.root;
		for (const segment of thisPath) {
			if (segment === '*') {
				node.hasWildcardChild = true;
				break;
			}
			if (!node.children.has(segment)) {
				node.children.set(segment, new TrieNode());
			}

			node = node.children.get(segment)!;
		}

		node.isEndOfPath = true;
	}

Domain

Subdomains

Called By

Frequently Asked Questions

What does insert() do?
insert() is a function in the astro codebase, defined in packages/integrations/cloudflare/src/utils/generate-routes-json.ts.
Where is insert() defined?
insert() is defined in packages/integrations/cloudflare/src/utils/generate-routes-json.ts at line 96.
What calls insert()?
insert() is called by 1 function(s): createRoutesFile.

Analyze Your Own Codebase

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

Try Supermodel Free