UNPKG

@cowwoc/requirements

Version:

A fluent API for enforcing design contracts with automatic message generation.

32 lines (31 loc) 1.62 kB
import { type Configuration, type MapValidator, type ValidationFailure, ObjectSizeValidatorImpl, type ApplicationScope, ArrayValidatorImpl, AbstractValidator, ValidationTarget } from "../internal.mjs"; /** * Default implementation of `MapValidator`. * * @typeParam T - the type of the value * @typeParam K - the type of keys in the map * @typeParam V - the type of values in the map */ declare class MapValidatorImpl<T extends Map<K, V> | undefined | null, K, V> extends AbstractValidator<T> implements MapValidator<T, K, V> { /** * Creates a new MapValidatorImpl. * * @param scope - the application configuration * @param configuration - the validator configuration * @param name - the name of the value * @param value - the value being validated * @param context - the contextual information set by the user * @param failures - the list of validation failures * @throws TypeError if `name` is `undefined` or `null` * @throws RangeError if `name` contains whitespace, or is empty * @throws AssertionError if `scope`, `configuration, `value`, `context or `failures` are null */ constructor(scope: ApplicationScope, configuration: Configuration, name: string, value: ValidationTarget<T>, context: Map<string, unknown>, failures: ValidationFailure[]); isEmpty(): this; isNotEmpty(): this; keys(): ArrayValidatorImpl<K[], unknown>; values(): ArrayValidatorImpl<V[], unknown>; entries(): ArrayValidatorImpl<[K, V][], unknown>; size(): ObjectSizeValidatorImpl; } export { MapValidatorImpl };