Home / Function/ checkWeight() — astro Function Reference

checkWeight() — astro Function Reference

Architecture documentation for the checkWeight() function in filter-preloads.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  b30f384b_6f6d_53ba_7d28_7911c9ff4fca["checkWeight()"]
  b779aa4c_fa5b_6be0_853d_7e9457320b63["filter-preloads.ts"]
  b30f384b_6f6d_53ba_7d28_7911c9ff4fca -->|defined in| b779aa4c_fa5b_6be0_853d_7e9457320b63
  89cb31aa_5261_3d6d_adae_891147154070["filterPreloads()"]
  89cb31aa_5261_3d6d_adae_891147154070 -->|calls| b30f384b_6f6d_53ba_7d28_7911c9ff4fca
  style b30f384b_6f6d_53ba_7d28_7911c9ff4fca fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/assets/fonts/core/filter-preloads.ts lines 38–51

function checkWeight(input: string, target: string): boolean {
	// If the input looks like "100 900", we check it as is
	const trimmedInput = input.trim();
	if (trimmedInput.includes(' ')) {
		return trimmedInput === target;
	}
	// If the target looks like "100 900", we check if the input is between the values
	if (target.includes(' ')) {
		const [a, b] = target.split(' ');
		const parsedInput = Number.parseInt(input);
		return parsedInput >= Number.parseInt(a) && parsedInput <= Number.parseInt(b);
	}
	return input === target;
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does checkWeight() do?
checkWeight() is a function in the astro codebase, defined in packages/astro/src/assets/fonts/core/filter-preloads.ts.
Where is checkWeight() defined?
checkWeight() is defined in packages/astro/src/assets/fonts/core/filter-preloads.ts at line 38.
What calls checkWeight()?
checkWeight() is called by 1 function(s): filterPreloads.

Analyze Your Own Codebase

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

Try Supermodel Free