Class: MapValidator<K, V>
Extends
BaseValidator
<Map
<K
,V
>>
Type Parameters
Type Parameter |
---|
K |
V |
Constructors
new MapValidator()
new MapValidator<
K
,V
>(keyValidator
:BaseValidator
<K
>,valueValidator
:BaseValidator
<V
>,validatorOptions
:ValidatorOptions
,constraints
: readonlyIConstraint
<Map
<K
,V
>,Map
<K
,V
>>[]):MapValidator
<K
,V
>
Parameters
Parameter | Type | Default value |
---|---|---|
keyValidator | BaseValidator <K > | undefined |
valueValidator | BaseValidator <V > | undefined |
validatorOptions | ValidatorOptions | {} |
constraints | readonly IConstraint <Map <K , V >, Map <K , V >>[] | [] |
Returns
MapValidator
<K
, V
>
Overrides
Defined in
projects/shapeshift/src/validators/MapValidator.ts:13
Properties
constraints
protected
constraints: readonlyIConstraint
<Map
<K
,V
>,Map
<K
,V
>>[] =[]
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:19
description?
optional
description:string
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:16
isValidationEnabled
protected
isValidationEnabled:null
|boolean
| () =>boolean
=null
Inherited from
BaseValidator
.isValidationEnabled
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:20
parent?
protected
optional
parent:object
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:18
validatorOptions
protected
validatorOptions:ValidatorOptions
Inherited from
BaseValidator
.validatorOptions
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:17
Accessors
shouldRunConstraints
Get Signature
get
protected
shouldRunConstraints():boolean
Returns
boolean
Inherited from
BaseValidator
.shouldRunConstraints
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:143
Methods
addConstraint()
protected
addConstraint(constraint
:IConstraint
<Map
<K
,V
>,Map
<K
,V
>>,validatorOptions
:ValidatorOptions
):this
Parameters
Parameter | Type |
---|---|
constraint | IConstraint <Map <K , V >, Map <K , V >> |
validatorOptions | ValidatorOptions |
Returns
this
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:155
array()
array(
options
:ValidatorOptions
):ArrayValidator
<Map
<K
,V
>[],Map
<K
,V
>>
Parameters
Parameter | Type |
---|---|
options | ValidatorOptions |
Returns
ArrayValidator
<Map
<K
, V
>[], Map
<K
, V
>>
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:44
clone()
protected
clone():this
Returns
this
Overrides
Defined in
projects/shapeshift/src/validators/MapValidator.ts:24
default()
default(
value
:Map
<K
,V
> | () =>Map
<K
,V
>,options
:ValidatorOptions
):DefaultValidator
<Map
<K
,V
>>
Parameters
Parameter | Type |
---|---|
value | Map <K , V > | () => Map <K , V > |
options | ValidatorOptions |
Returns
DefaultValidator
<Map
<K
, V
>>
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:81
describe()
describe(
description
:string
):this
Parameters
Parameter | Type |
---|---|
description | string |
Returns
this
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:96
getValidationEnabled()
getValidationEnabled():
null
|boolean
Returns
null
| boolean
Inherited from
BaseValidator
.getValidationEnabled
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:139
handle()
protected
handle(value
:unknown
):Result
<Map
<K
,V
>,ValidationError
|CombinedPropertyError
>
Parameters
Parameter | Type |
---|---|
value | unknown |
Returns
Result
<Map
<K
, V
>, ValidationError
| CombinedPropertyError
>
Overrides
Defined in
projects/shapeshift/src/validators/MapValidator.ts:28
is()
is<
R
>(value
:unknown
):value is R
Type Parameters
Type Parameter | Default type |
---|---|
R extends Map <K , V > | Map <K , V > |
Parameters
Parameter | Type |
---|---|
value | unknown |
Returns
value is R
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:124
nullable()
nullable(
options
:ValidatorOptions
):UnionValidator
<null
|Map
<K
,V
>>
Parameters
Parameter | Type |
---|---|
options | ValidatorOptions |
Returns
UnionValidator
<null
| Map
<K
, V
>>
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:36
nullish()
nullish(
options
:ValidatorOptions
):UnionValidator
<undefined
|null
|Map
<K
,V
>>
Parameters
Parameter | Type |
---|---|
options | ValidatorOptions |
Returns
UnionValidator
<undefined
| null
| Map
<K
, V
>>
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:40
optional()
optional(
options
:ValidatorOptions
):UnionValidator
<undefined
|Map
<K
,V
>>
Parameters
Parameter | Type |
---|---|
options | ValidatorOptions |
Returns
UnionValidator
<undefined
| Map
<K
, V
>>
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:32
or()
or<
O
>(...predicates
: readonlyBaseValidator
<O
>[]):UnionValidator
<Map
<K
,V
> |O
>
Type Parameters
Type Parameter |
---|
O |
Parameters
Parameter | Type |
---|---|
...predicates | readonly BaseValidator <O >[] |
Returns
UnionValidator
<Map
<K
, V
> | O
>
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:52
parse()
parse<
R
>(value
:unknown
):R
Type Parameters
Type Parameter | Default type |
---|---|
R extends Map <K , V > | Map <K , V > |
Parameters
Parameter | Type |
---|---|
value | unknown |
Returns
R
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:114
reshape()
reshape(cb, options)
reshape(
cb
: (input
:Map
<K
,V
>) =>Result
<Map
<K
,V
>,Error
>,options
?:ValidatorOptions
):this
Parameters
Parameter | Type |
---|---|
cb | (input : Map <K , V >) => Result <Map <K , V >, Error > |
options ? | ValidatorOptions |
Returns
this
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:67
reshape(cb, options)
reshape<
R
,O
>(cb
: (input
:Map
<K
,V
>) =>R
,options
?:ValidatorOptions
):BaseValidator
<O
>
Type Parameters
Type Parameter | Default type |
---|---|
R extends Result <unknown , Error > | - |
O | InferResultType <R > |
Parameters
Parameter | Type |
---|---|
cb | (input : Map <K , V >) => R |
options ? | ValidatorOptions |
Returns
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:68
run()
Parameters
Parameter | Type |
---|---|
value | unknown |
Returns
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:102
set()
set(
options
:ValidatorOptions
):SetValidator
<Map
<K
,V
>>
Parameters
Parameter | Type |
---|---|
options | ValidatorOptions |
Returns
SetValidator
<Map
<K
, V
>>
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:48
setParent()
setParent(
parent
:object
):this
Parameters
Parameter | Type |
---|---|
parent | object |
Returns
this
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:27
setValidationEnabled()
setValidationEnabled(
isValidationEnabled
:null
|boolean
| () =>boolean
):this
Sets if the validator should also run constraints or just do basic checks.
Parameters
Parameter | Type | Description |
---|---|---|
isValidationEnabled | null | boolean | () => boolean | Whether this validator should be enabled or disabled. You can pass boolean or a function returning boolean which will be called just before parsing. Set to null to go off of the global configuration. |
Returns
this
Inherited from
BaseValidator
.setValidationEnabled
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:133
transform()
transform(cb, options)
transform(
cb
: (value
:Map
<K
,V
>) =>Map
<K
,V
>,options
?:ValidatorOptions
):this
Parameters
Parameter | Type |
---|---|
cb | (value : Map <K , V >) => Map <K , V > |
options ? | ValidatorOptions |
Returns
this
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:56
transform(cb, options)
transform<
O
>(cb
: (value
:Map
<K
,V
>) =>O
,options
?:ValidatorOptions
):BaseValidator
<O
>
Type Parameters
Type Parameter |
---|
O |
Parameters
Parameter | Type |
---|---|
cb | (value : Map <K , V >) => O |
options ? | ValidatorOptions |
Returns
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:57
when()
when<
Key
,This
>(key
:Key
,options
:WhenOptions
<This
,Key
>,validatorOptions
?:ValidatorOptions
):this
Type Parameters
Type Parameter | Default type |
---|---|
Key extends WhenKey | - |
This extends BaseValidator <any > | MapValidator <K , V > |
Parameters
Parameter | Type |
---|---|
key | Key |
options | WhenOptions <This , Key > |
validatorOptions ? | ValidatorOptions |
Returns
this