Home / Function/ enumValidator() — astro Function Reference

enumValidator() — astro Function Reference

Architecture documentation for the enumValidator() function in validators.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  86f01652_8ed4_3b66_e1c4_4d614b23e797["enumValidator()"]
  507d4b59_27b6_fc34_cbc8_02ec1d1596e5["validators.ts"]
  86f01652_8ed4_3b66_e1c4_4d614b23e797 -->|defined in| 507d4b59_27b6_fc34_cbc8_02ec1d1596e5
  9f0736b8_fe2c_7232_075d_3effa18267d9["selectValidator()"]
  9f0736b8_fe2c_7232_075d_3effa18267d9 -->|calls| 86f01652_8ed4_3b66_e1c4_4d614b23e797
  style 86f01652_8ed4_3b66_e1c4_4d614b23e797 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/env/validators.ts lines 133–145

	({ values }: EnumSchema): ValueValidator =>
	(input) => {
		if (!(typeof input === 'string' ? values.includes(input) : false)) {
			return {
				ok: false,
				errors: ['type'],
			};
		}
		return {
			ok: true,
			value: input,
		};
	};

Domain

Subdomains

Called By

Frequently Asked Questions

What does enumValidator() do?
enumValidator() is a function in the astro codebase, defined in packages/astro/src/env/validators.ts.
Where is enumValidator() defined?
enumValidator() is defined in packages/astro/src/env/validators.ts at line 133.
What calls enumValidator()?
enumValidator() is called by 1 function(s): selectValidator.

Analyze Your Own Codebase

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

Try Supermodel Free