Skip to main content

Class: MapValidator<K, V>

Type parameters

Name
K
V

Hierarchy

Constructors

constructor

new MapValidator<K, V>(keyValidator, valueValidator, constraints?)

Type parameters

Name
K
V

Parameters

NameTypeDefault value
keyValidatorBaseValidator<K>undefined
valueValidatorBaseValidator<V>undefined
constraintsreadonly IConstraint<Map<K, V>, Map<K, V>>[][]

Overrides

BaseValidator.constructor

Defined in

projects/shapeshift/src/validators/MapValidator.ts:12

Properties

constraints

Protected constraints: readonly IConstraint<Map<K, V>, Map<K, V>>[] = []

Inherited from

BaseValidator.constraints

Defined in

projects/shapeshift/src/validators/BaseValidator.ts:11


keyValidator

Private Readonly keyValidator: BaseValidator<K>

Defined in

projects/shapeshift/src/validators/MapValidator.ts:9


valueValidator

Private Readonly valueValidator: BaseValidator<V>

Defined in

projects/shapeshift/src/validators/MapValidator.ts:10

Accessors

array

get array(): ArrayValidator<T>

Returns

ArrayValidator<T>

Inherited from

BaseValidator.array

Defined in

projects/shapeshift/src/validators/BaseValidator.ts:29


nullable

get nullable(): UnionValidator<null | T>

Returns

UnionValidator<null | T>

Inherited from

BaseValidator.nullable

Defined in

projects/shapeshift/src/validators/BaseValidator.ts:21


nullish

get nullish(): UnionValidator<undefined | null | T>

Returns

UnionValidator<undefined | null | T>

Inherited from

BaseValidator.nullish

Defined in

projects/shapeshift/src/validators/BaseValidator.ts:25


optional

get optional(): UnionValidator<undefined | T>

Returns

UnionValidator<undefined | T>

Inherited from

BaseValidator.optional

Defined in

projects/shapeshift/src/validators/BaseValidator.ts:17


set

get set(): SetValidator<T>

Returns

SetValidator<T>

Inherited from

BaseValidator.set

Defined in

projects/shapeshift/src/validators/BaseValidator.ts:33

Methods

addConstraint

Protected addConstraint(constraint): MapValidator<K, V>

Parameters

NameType
constraintIConstraint<Map<K, V>, Map<K, V>>

Returns

MapValidator<K, V>

Inherited from

BaseValidator.addConstraint

Defined in

projects/shapeshift/src/validators/BaseValidator.ts:73


clone

Protected clone(): MapValidator<K, V>

Returns

MapValidator<K, V>

Overrides

BaseValidator.clone

Defined in

projects/shapeshift/src/validators/MapValidator.ts:18


default

default(value): DefaultValidator<Map<K, V>>

Parameters

NameType
valueMap<K, V> | () => Map<K, V>

Returns

DefaultValidator<Map<K, V>>

Inherited from

BaseValidator.default

Defined in

projects/shapeshift/src/validators/BaseValidator.ts:47


handle

Protected handle(value): Result<Map<K, V>, CombinedPropertyError | ValidationError>

Parameters

NameType
valueunknown

Returns

Result<Map<K, V>, CombinedPropertyError | ValidationError>

Overrides

BaseValidator.handle

Defined in

projects/shapeshift/src/validators/MapValidator.ts:22


or

or<O>(...predicates): UnionValidator<Map<K, V> | O>

Type parameters

Name
O

Parameters

NameType
...predicatesreadonly BaseValidator<O>[]

Returns

UnionValidator<Map<K, V> | O>

Inherited from

BaseValidator.or

Defined in

projects/shapeshift/src/validators/BaseValidator.ts:37


parse

parse(value): Map<K, V>

Parameters

NameType
valueunknown

Returns

Map<K, V>

Inherited from

BaseValidator.parse

Defined in

projects/shapeshift/src/validators/BaseValidator.ts:63


run

run(value): Result<Map<K, V>, BaseError>

Parameters

NameType
valueunknown

Returns

Result<Map<K, V>, BaseError>

Inherited from

BaseValidator.run

Defined in

projects/shapeshift/src/validators/BaseValidator.ts:51


transform

transform(cb): MapValidator<K, V>

Parameters

NameType
cb(value: Map<K, V>) => Map<K, V>

Returns

MapValidator<K, V>

Inherited from

BaseValidator.transform

Defined in

projects/shapeshift/src/validators/BaseValidator.ts:41

transform<O>(cb): BaseValidator<O>

Type parameters

Name
O

Parameters

NameType
cb(value: Map<K, V>) => O

Returns

BaseValidator<O>

Inherited from

BaseValidator.transform

Defined in

projects/shapeshift/src/validators/BaseValidator.ts:42