Class: RecordValidator<T>
Extends
BaseValidator<Record<string,T>>
Type parameters
| Type parameter |
|---|
T |
Constructors
new RecordValidator()
new RecordValidator<
T>(validator:BaseValidator<T>,validatorOptions:ValidatorOptions,constraints: readonlyIConstraint<Record<string,T>,Record<string,T>>[]):RecordValidator<T>
Parameters
| Parameter | Type | Default value |
|---|---|---|
validator | BaseValidator<T> | undefined |
validatorOptions | ValidatorOptions | {} |
constraints | readonly IConstraint <Record<string, T>, Record<string, T>>[] | [] |
Returns
Overrides
Source
projects/shapeshift/src/validators/RecordValidator.ts:12
Properties
constraints
protectedconstraints: readonlyIConstraint<Record<string,T>,Record<string,T>>[] =[]
Inherited from
Source
projects/shapeshift/src/validators/BaseValidator.ts:19
description?
optionaldescription:string
Inherited from
Source
projects/shapeshift/src/validators/BaseValidator.ts:16
isValidationEnabled
protectedisValidationEnabled:null|boolean| () =>boolean=null
Inherited from
BaseValidator . isValidationEnabled
Source
projects/shapeshift/src/validators/BaseValidator.ts:20
parent?
protectedoptionalparent:object
Inherited from
Source
projects/shapeshift/src/validators/BaseValidator.ts:18
validator
privatereadonlyvalidator:BaseValidator<T>
Source
projects/shapeshift/src/validators/RecordValidator.ts:10
validatorOptions
protectedvalidatorOptions:ValidatorOptions
Inherited from
BaseValidator . validatorOptions
Source
projects/shapeshift/src/validators/BaseValidator.ts:17
Accessors
shouldRunConstraints
getprotectedshouldRunConstraints():boolean
Returns
boolean
Source
projects/shapeshift/src/validators/BaseValidator.ts:143
Methods
addConstraint()
protectedaddConstraint(constraint:IConstraint<Record<string,T>,Record<string,T>>,validatorOptions:ValidatorOptions):this
Parameters
| Parameter | Type |
|---|---|
constraint | IConstraint <Record<string, T>, Record<string, T>> |
validatorOptions | ValidatorOptions |
Returns
this
Inherited from
Source
projects/shapeshift/src/validators/BaseValidator.ts:155
array()
array(
options:ValidatorOptions):ArrayValidator<Record<string,T>[],Record<string,T>>
Parameters
| Parameter | Type |
|---|---|
options | ValidatorOptions |
Returns
ArrayValidator <Record<string, T>[], Record<string, T>>
Inherited from
Source
projects/shapeshift/src/validators/BaseValidator.ts:44
clone()
protectedclone():this
Returns
this
Overrides
Source
projects/shapeshift/src/validators/RecordValidator.ts:21
default()
default(
value:Record<string,T> | () =>Record<string,T>,options:ValidatorOptions):DefaultValidator<Record<string,T>>
Parameters
| Parameter | Type |
|---|---|
value | Record<string, T> | () => Record<string, T> |
options | ValidatorOptions |
Returns
DefaultValidator <Record<string, T>>
Inherited from
Source
projects/shapeshift/src/validators/BaseValidator.ts:81
describe()
describe(
description:string):this
Parameters
| Parameter | Type |
|---|---|
description | string |
Returns
this
Inherited from
Source
projects/shapeshift/src/validators/BaseValidator.ts:96
getValidationEnabled()
getValidationEnabled():
null|boolean
Returns
null | boolean
Inherited from
BaseValidator . getValidationEnabled
Source
projects/shapeshift/src/validators/BaseValidator.ts:139
handle()
protectedhandle(value:unknown):Result<Record<string,T>,ValidationError|CombinedPropertyError>
Parameters
| Parameter | Type |
|---|---|
value | unknown |
Returns
Result <Record<string, T>, ValidationError | CombinedPropertyError>
Overrides
Source
projects/shapeshift/src/validators/RecordValidator.ts:25
is()
is<
R>(value:unknown):value is R
Type parameters
| Type parameter | Value |
|---|---|
R extends Record<string, T> | Record<string, T> |
Parameters
| Parameter | Type |
|---|---|
value | unknown |
Returns
value is R
Inherited from
Source
projects/shapeshift/src/validators/BaseValidator.ts:124
nullable()
nullable(
options:ValidatorOptions):UnionValidator<null|Record<string,T>>
Parameters
| Parameter | Type |
|---|---|
options | ValidatorOptions |
Returns
UnionValidator<null | Record<string, T>>
Inherited from
Source
projects/shapeshift/src/validators/BaseValidator.ts:36
nullish()
nullish(
options:ValidatorOptions):UnionValidator<undefined|null|Record<string,T>>
Parameters
| Parameter | Type |
|---|---|
options | ValidatorOptions |
Returns
UnionValidator<undefined | null | Record<string, T>>
Inherited from
Source
projects/shapeshift/src/validators/BaseValidator.ts:40
optional()
optional(
options:ValidatorOptions):UnionValidator<undefined|Record<string,T>>
Parameters
| Parameter | Type |
|---|---|
options | ValidatorOptions |
Returns
UnionValidator<undefined | Record<string, T>>
Inherited from
Source
projects/shapeshift/src/validators/BaseValidator.ts:32
or()
or<
O>(...predicates: readonlyBaseValidator<O>[]):UnionValidator<Record<string,T> |O>
Type parameters
| Type parameter |
|---|
O |
Parameters
| Parameter | Type |
|---|---|
...predicates | readonly BaseValidator<O>[] |
Returns
UnionValidator <Record<string, T> | O>
Inherited from
Source
projects/shapeshift/src/validators/BaseValidator.ts:52
parse()
parse<
R>(value:unknown):R
Type parameters
| Type parameter | Value |
|---|---|
R extends Record<string, T> | Record<string, T> |
Parameters
| Parameter | Type |
|---|---|
value | unknown |
Returns
R
Inherited from
Source
projects/shapeshift/src/validators/BaseValidator.ts:114
reshape()
reshape(cb, options)
reshape(
cb: (input:Record<string,T>) =>Result<Record<string,T>,Error>,options?:ValidatorOptions):this
Parameters
| Parameter | Type |
|---|---|
cb | (input: Record<string, T>) => Result <Record<string, T>, Error> |
options? | ValidatorOptions |
Returns
this
Inherited from
Source
projects/shapeshift/src/validators/BaseValidator.ts:67