Class: NullishValidator
Hierarchy
BaseValidator
<undefined
|null
>↳
NullishValidator
Constructors
constructor
• new NullishValidator(constraints?
)
Parameters
Name | Type | Default value |
---|---|---|
constraints | readonly IConstraint <undefined | null , undefined | null >[] | [] |
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:13
Properties
constraints
• Protected
constraints: readonly IConstraint
<undefined
| null
, undefined
| null
>[] = []
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:11
Accessors
array
• get
array(): ArrayValidator
<T
>
Returns
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
): NullishValidator
Parameters
Name | Type |
---|---|
constraint | IConstraint <undefined | null , undefined | null > |
Returns
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:73
clone
▸ Protected
clone(): NullishValidator
Returns
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:67
default
▸ default(value
): DefaultValidator
<null
>
Parameters
Name | Type |
---|---|
value | null | () => null |
Returns
DefaultValidator
<null
>
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:47
handle
▸ Protected
handle(value
): Result
<undefined
| null
, ValidationError
>
Parameters
Name | Type |
---|---|
value | unknown |
Returns
Result
<undefined
| null
, ValidationError
>
Overrides
Defined in
projects/shapeshift/src/validators/NullishValidator.ts:6
or
▸ or<O
>(...predicates
): UnionValidator
<undefined
| null
| O
>
Type parameters
Name |
---|
O |
Parameters
Name | Type |
---|---|
...predicates | readonly BaseValidator <O >[] |
Returns
UnionValidator
<undefined
| null
| O
>
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:37
parse
▸ parse(value
): undefined
| null
Parameters
Name | Type |
---|---|
value | unknown |
Returns
undefined
| null
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:63
run
▸ run(value
): Result
<undefined
| null
, BaseError
>
Parameters
Name | Type |
---|---|
value | unknown |
Returns
Result
<undefined
| null
, BaseError
>
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:51
transform
▸ transform(cb
): NullishValidator
Parameters
Name | Type |
---|---|
cb | (value : undefined | null ) => undefined | null |
Returns
Inherited from
Defined in
projects/shapeshift/src/validators/BaseValidator.ts:41
▸ transform<O
>(cb
): BaseValidator
<O
>
Type parameters
Name |
---|
O |
Parameters
Name | Type |
---|---|
cb | (value : undefined | null ) => O |