Skip to main content

Class: SetValidator<T>

Type parameters

Name
T

Hierarchy

Constructors

constructor

new SetValidator<T>(validator, constraints?)

Type parameters

Name
T

Parameters

NameTypeDefault value
validatorBaseValidator<T>undefined
constraintsreadonly IConstraint<Set<T>, Set<T>>[][]

Overrides

BaseValidator.constructor

Defined in

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

Properties

constraints

Protected constraints: readonly IConstraint<Set<T>, Set<T>>[] = []

Inherited from

BaseValidator.constraints

Defined in

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


isValidationEnabled

Protected isValidationEnabled: null | boolean | () => boolean = null

Inherited from

BaseValidator.isValidationEnabled

Defined in

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


validator

Private Readonly validator: BaseValidator<T>

Defined in

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

Accessors

array

get array(): ArrayValidator<T[], T>

Returns

ArrayValidator<T[], T>

Inherited from

BaseValidator.array

Defined in

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


nullable

get nullable(): UnionValidator<null | T>

Returns

UnionValidator<null | T>

Inherited from

BaseValidator.nullable

Defined in

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


nullish

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

Returns

UnionValidator<undefined | null | T>

Inherited from

BaseValidator.nullish

Defined in

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


optional

get optional(): UnionValidator<undefined | T>

Returns

UnionValidator<undefined | T>

Inherited from

BaseValidator.optional

Defined in

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


set

get set(): SetValidator<T>

Returns

SetValidator<T>

Inherited from

BaseValidator.set

Defined in

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


shouldRunConstraints

Protected get shouldRunConstraints(): boolean

Returns

boolean

Inherited from

BaseValidator.shouldRunConstraints

Defined in

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

Methods

addConstraint

Protected addConstraint(constraint): SetValidator<T>

Parameters

NameType
constraintIConstraint<Set<T>, Set<T>>

Returns

SetValidator<T>

Inherited from

BaseValidator.addConstraint

Defined in

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


clone

Protected clone(): SetValidator<T>

Returns

SetValidator<T>

Overrides

BaseValidator.clone

Defined in

projects/shapeshift/src/validators/SetValidator.ts:16


default

default(value): DefaultValidator<Set<T>>

Parameters

NameType
valueSet<T> | () => Set<T>

Returns

DefaultValidator<Set<T>>

Inherited from

BaseValidator.default

Defined in

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


getValidationEnabled

getValidationEnabled(): null | boolean

Returns

null | boolean

Inherited from

BaseValidator.getValidationEnabled

Defined in

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


handle

Protected handle(values): Result<Set<T>, CombinedError | ValidationError>

Parameters

NameType
valuesunknown

Returns

Result<Set<T>, CombinedError | ValidationError>

Overrides

BaseValidator.handle

Defined in

projects/shapeshift/src/validators/SetValidator.ts:20


or

or<O>(...predicates): UnionValidator<Set<T> | O>

Type parameters

Name
O

Parameters

NameType
...predicatesreadonly BaseValidator<O>[]

Returns

UnionValidator<Set<T> | O>

Inherited from

BaseValidator.or

Defined in

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


parse

parse<R>(value): R

Type parameters

NameType
Rextends Set<T, R> = Set<T>

Parameters

NameType
valueunknown

Returns

R

Inherited from

BaseValidator.parse

Defined in

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


run

run(value): Result<Set<T>, BaseError>

Parameters

NameType
valueunknown

Returns

Result<Set<T>, BaseError>

Inherited from

BaseValidator.run

Defined in

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


setValidationEnabled

setValidationEnabled(isValidationEnabled): SetValidator<T>

Parameters

NameTypeDescription
isValidationEnablednull | boolean | () => boolean

Returns

SetValidator<T>

Inherited from

BaseValidator.setValidationEnabled

Defined in

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


transform

transform(cb): SetValidator<T>

Parameters

NameType
cb(value: Set<T>) => Set<T>

Returns

SetValidator<T>

Inherited from

BaseValidator.transform

Defined in

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

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

Type parameters

Name
O

Parameters

NameType
cb(value: Set<T>) => O

Returns

BaseValidator<O>

Inherited from

BaseValidator.transform

Defined in

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