Home / Function/ countOccurrences() — astro Function Reference

countOccurrences() — astro Function Reference

Architecture documentation for the countOccurrences() function in segment.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  97157675_b53c_744a_172b_6e8e37401fee["countOccurrences()"]
  ee14400b_0632_5530_5739_3620df74d56f["segment.ts"]
  97157675_b53c_744a_172b_6e8e37401fee -->|defined in| ee14400b_0632_5530_5739_3620df74d56f
  558914a8_7fcc_6dc1_63b1_b932026681fb["validateSegment()"]
  558914a8_7fcc_6dc1_63b1_b932026681fb -->|calls| 97157675_b53c_744a_172b_6e8e37401fee
  style 97157675_b53c_744a_172b_6e8e37401fee fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/core/routing/manifest/segment.ts lines 18–24

function countOccurrences(needle: string, haystack: string) {
	let count = 0;
	for (const hay of haystack) {
		if (hay === needle) count += 1;
	}
	return count;
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does countOccurrences() do?
countOccurrences() is a function in the astro codebase, defined in packages/astro/src/core/routing/manifest/segment.ts.
Where is countOccurrences() defined?
countOccurrences() is defined in packages/astro/src/core/routing/manifest/segment.ts at line 18.
What calls countOccurrences()?
countOccurrences() is called by 1 function(s): validateSegment.

Analyze Your Own Codebase

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

Try Supermodel Free