Interface: NullishValidator
Defined in: projects/shapeshift/src/validators/NullishValidator.ts:5
Extends
BaseValidator<undefined|null>
Properties
constraints
protectedconstraints: readonlyIConstraint<undefined|null,undefined|null>[] =[]
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:19
Inherited from
description?
optionaldescription:string
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:16
Inherited from
isValidationEnabled
protectedisValidationEnabled:null|boolean| () =>boolean=null
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:20
Inherited from
BaseValidator.isValidationEnabled
parent?
protectedoptionalparent:object
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:18
Inherited from
validatorOptions
protectedvalidatorOptions:ValidatorOptions
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:17
Inherited from
BaseValidator.validatorOptions
Accessors
shouldRunConstraints
Get Signature
get
protectedshouldRunConstraints():boolean
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:143
Returns
boolean
Inherited from
BaseValidator.shouldRunConstraints
Methods
addConstraint()
protectedaddConstraint(constraint:IConstraint<undefined|null>,validatorOptions:ValidatorOptions):this
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:155
Parameters
| Parameter | Type |
|---|---|
constraint | IConstraint<undefined | null> |
validatorOptions | ValidatorOptions |
Returns
this
Inherited from
array()
array(
options:ValidatorOptions):ArrayValidator<(undefined|null)[]>
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:44
Parameters
| Parameter | Type |
|---|---|
options | ValidatorOptions |
Returns
ArrayValidator<(undefined | null)[]>
Inherited from
clone()
protectedclone():this
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:147
Returns
this
Inherited from
default()
default(
value:null| () =>null,options:ValidatorOptions):DefaultValidator<null>
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:81
Parameters
| Parameter | Type |
|---|---|
value | null | () => null |
options | ValidatorOptions |
Returns
DefaultValidator<null>
Inherited from
describe()
describe(
description:string):this
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:96
Parameters
| Parameter | Type |
|---|---|
description | string |
Returns
this
Inherited from
getValidationEnabled()
getValidationEnabled():
null|boolean
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:139
Returns
null | boolean
Inherited from
BaseValidator.getValidationEnabled
handle()
protectedhandle(value:unknown):Result<undefined|null,ValidationError>
Defined in: projects/shapeshift/src/validators/NullishValidator.ts:6
Parameters
| Parameter | Type |
|---|---|
value | unknown |
Returns
Result<undefined | null, ValidationError>
Overrides
is()
is<
R>(value:unknown):value is R
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:124
Type Parameters
| Type Parameter | Default type |
|---|---|
R extends undefined | null | undefined | null |
Parameters
| Parameter | Type |
|---|---|
value | unknown |
Returns
value is R
Inherited from
nullable()
nullable(
options:ValidatorOptions):UnionValidator<undefined|null>
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:36
Parameters
| Parameter | Type |
|---|---|
options | ValidatorOptions |
Returns
UnionValidator<undefined | null>
Inherited from
nullish()
nullish(
options:ValidatorOptions):UnionValidator<undefined|null>
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:40
Parameters
| Parameter | Type |
|---|---|
options | ValidatorOptions |
Returns
UnionValidator<undefined | null>
Inherited from
optional()
optional(
options:ValidatorOptions):UnionValidator<undefined|null>
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:32
Parameters
| Parameter | Type |
|---|---|
options | ValidatorOptions |
Returns
UnionValidator<undefined | null>
Inherited from
or()
or<
O>(...predicates: readonlyBaseValidator<O>[]):UnionValidator<undefined|null|O>
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:52
Type Parameters
| Type Parameter |
|---|
O |
Parameters
| Parameter | Type |
|---|---|
...predicates | readonly BaseValidator<O>[] |
Returns
UnionValidator<undefined | null | O>
Inherited from
parse()
parse<
R>(value:unknown):R
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:114
Type Parameters
| Type Parameter | Default type |
|---|---|
R extends undefined | null | undefined | null |
Parameters
| Parameter | Type |
|---|---|
value | unknown |
Returns
R
Inherited from
reshape()
Call Signature
reshape(
cb: (input:undefined|null) =>Result<undefined|null>,options?:ValidatorOptions):this
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:67
Parameters
| Parameter | Type |
|---|---|
cb | (input: undefined | null) => Result<undefined | null> |
options? | ValidatorOptions |
Returns
this
Inherited from
Call Signature
reshape<
R,O>(cb: (input:undefined|null) =>R,options?:ValidatorOptions):BaseValidator<O>
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:68
Type Parameters
| Type Parameter | Default type |
|---|---|
R extends Result<unknown, Error> | - |
O | InferResultType<R> |
Parameters
| Parameter | Type |
|---|---|
cb | (input: undefined | null) => R |
options? | ValidatorOptions |
Returns
Inherited from
run()
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:102
Parameters
| Parameter | Type |
|---|---|
value | unknown |
Returns
Result<undefined | null, BaseError>
Inherited from
set()
set(
options:ValidatorOptions):SetValidator<undefined|null>
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:48
Parameters
| Parameter | Type |
|---|---|
options | ValidatorOptions |
Returns
SetValidator<undefined | null>
Inherited from
setParent()
setParent(
parent:object):this
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:27
Parameters
| Parameter | Type |
|---|---|
parent | object |
Returns
this
Inherited from
setValidationEnabled()
setValidationEnabled(
isValidationEnabled:null|boolean| () =>boolean):this
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:133
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
transform()
Call Signature
transform(
cb: (value:undefined|null) =>undefined|null,options?:ValidatorOptions):this
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:56
Parameters
| Parameter | Type |
|---|---|
cb | (value: undefined | null) => undefined | null |
options? | ValidatorOptions |
Returns
this
Inherited from
Call Signature
transform<
O>(cb: (value:undefined|null) =>O,options?:ValidatorOptions):BaseValidator<O>
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:57
Type Parameters
| Type Parameter |
|---|
O |
Parameters
| Parameter | Type |
|---|---|
cb | (value: undefined | null) => O |
options? | ValidatorOptions |
Returns
Inherited from
when()
when<
Key,This>(key:Key,options:WhenOptions<This,Key>,validatorOptions?:ValidatorOptions):this
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:88
Type Parameters
| Type Parameter | Default type |
|---|---|
Key extends WhenKey | - |
This extends BaseValidator<any> | NullishValidator |
Parameters
| Parameter | Type |
|---|---|
key | Key |
options | WhenOptions<This, Key> |
validatorOptions? | ValidatorOptions |
Returns
this