Skip to content

Function.map

github-actions[bot] edited this page May 26, 2026 · 29 revisions

umt / map

Function: map()

map<KV, VV, K, V>(keyValidator?, valueValidator?, message?): (value) => ValidateCoreReturnType<Map<K, V>> & StandardSchemaV1<Map<K, V>, Map<K, V>>

Defined in: Validate/map/core.ts:32

Creates a Map validator. The validator can optionally accept per-entry key and value validators that are applied to every entry of the map. When the value-side validator is provided, the entry validators short-circuit on the first failure and surface the failing message, mirroring arrayOf().

Type Parameters

KV

KV extends (value) => ValidateCoreReturnType<unknown> = (value) => ValidateCoreReturnType<unknown>

Validator for the map key

VV

VV extends (value) => ValidateCoreReturnType<unknown> = (value) => ValidateCoreReturnType<unknown>

Validator for the map value

K

K = MapExtractValidatedType<KV>

V

V = MapExtractValidatedType<VV>

Parameters

keyValidator?

KV

Validator applied to every key

valueValidator?

VV

Validator applied to every value

message?

string

Custom error message for type validation

Returns

(value) => ValidateCoreReturnType<Map<K, V>> & StandardSchemaV1<Map<K, V>, Map<K, V>>

  • Validator function for Map instances

API

Classes

Interfaces

Type Aliases

Variables

Functions

Clone this wiki locally