Skip to main content

Class: TypedArrayValidator<T>

Type parameters

NameType
Textends TypedArray

Hierarchy

Constructors

constructor

new TypedArrayValidator<T>(type, constraints?)

Type parameters

NameType
Textends TypedArray

Parameters

NameTypeDefault value
type"Int8Array" | "Uint8Array" | "Uint8ClampedArray" | "Int16Array" | "Uint16Array" | "Int32Array" | "Uint32Array" | "Float32Array" | "Float64Array" | "BigInt64Array" | "BigUint64Array" | "TypedArray"undefined
constraintsreadonly IConstraint<T, T>[][]

Overrides

BaseValidator.constructor

Defined in

projects/shapeshift/src/validators/TypedArrayValidator.ts:31

Properties

constraints

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

Inherited from

BaseValidator.constraints

Defined in

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


type

Private Readonly type: "Int8Array" | "Uint8Array" | "Uint8ClampedArray" | "Int16Array" | "Uint16Array" | "Int32Array" | "Uint32Array" | "Float32Array" | "Float64Array" | "BigInt64Array" | "BigUint64Array" | "TypedArray"

Defined in

projects/shapeshift/src/validators/TypedArrayValidator.ts:29

Accessors

array

get array(): ArrayValidator<T>

Returns

ArrayValidator<T>

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): TypedArrayValidator<T>

Parameters

NameType
constraintIConstraint<T, T>

Returns

TypedArrayValidator<T>

Inherited from

BaseValidator.addConstraint

Defined in

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


byteLengthEqual

byteLengthEqual(length): TypedArrayValidator<T>

Parameters

NameType
lengthnumber

Returns

TypedArrayValidator<T>

Defined in

projects/shapeshift/src/validators/TypedArrayValidator.ts:52


byteLengthGreaterThan

byteLengthGreaterThan(length): TypedArrayValidator<T>

Parameters

NameType
lengthnumber

Returns

TypedArrayValidator<T>

Defined in

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


byteLengthGreaterThanOrEqual

byteLengthGreaterThanOrEqual(length): TypedArrayValidator<T>

Parameters

NameType
lengthnumber

Returns

TypedArrayValidator<T>

Defined in

projects/shapeshift/src/validators/TypedArrayValidator.ts:48


byteLengthLessThan

byteLengthLessThan(length): TypedArrayValidator<T>

Parameters

NameType
lengthnumber

Returns

TypedArrayValidator<T>

Defined in

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


byteLengthLessThanOrEqual

byteLengthLessThanOrEqual(length): TypedArrayValidator<T>

Parameters

NameType
lengthnumber

Returns

TypedArrayValidator<T>

Defined in

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


byteLengthNotEqual

byteLengthNotEqual(length): TypedArrayValidator<T>

Parameters

NameType
lengthnumber

Returns

TypedArrayValidator<T>

Defined in

projects/shapeshift/src/validators/TypedArrayValidator.ts:56


byteLengthRange

byteLengthRange(start, endBefore): TypedArrayValidator<T>

Parameters

NameType
startnumber
endBeforenumber

Returns

TypedArrayValidator<T>

Defined in

projects/shapeshift/src/validators/TypedArrayValidator.ts:60


byteLengthRangeExclusive

byteLengthRangeExclusive(startAfter, endBefore): TypedArrayValidator<T>

Parameters

NameType
startAfternumber
endBeforenumber

Returns

TypedArrayValidator<T>

Defined in

projects/shapeshift/src/validators/TypedArrayValidator.ts:68


byteLengthRangeInclusive

byteLengthRangeInclusive(startAt, endAt): TypedArrayValidator<T>

Parameters

NameType
startAtnumber
endAtnumber

Returns

TypedArrayValidator<T>

Defined in

projects/shapeshift/src/validators/TypedArrayValidator.ts:64


clone

Protected clone(): TypedArrayValidator<T>

Returns

TypedArrayValidator<T>

Overrides

BaseValidator.clone

Defined in

projects/shapeshift/src/validators/TypedArrayValidator.ts:108


default

default(value): DefaultValidator<Exclude<T, undefined>>

Parameters

NameType
valueExclude<T, undefined> | () => Exclude<T, undefined>

Returns

DefaultValidator<Exclude<T, undefined>>

Inherited from

BaseValidator.default

Defined in

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


handle

Protected handle(value): Result<T, ValidationError>

Parameters

NameType
valueunknown

Returns

Result<T, ValidationError>

Overrides

BaseValidator.handle

Defined in

projects/shapeshift/src/validators/TypedArrayValidator.ts:112


lengthEqual

lengthEqual(length): TypedArrayValidator<T>

Parameters

NameType
lengthnumber

Returns

TypedArrayValidator<T>

Defined in

projects/shapeshift/src/validators/TypedArrayValidator.ts:88


lengthGreaterThan

lengthGreaterThan(length): TypedArrayValidator<T>

Parameters

NameType
lengthnumber

Returns

TypedArrayValidator<T>

Defined in

projects/shapeshift/src/validators/TypedArrayValidator.ts:80


lengthGreaterThanOrEqual

lengthGreaterThanOrEqual(length): TypedArrayValidator<T>

Parameters

NameType
lengthnumber

Returns

TypedArrayValidator<T>

Defined in

projects/shapeshift/src/validators/TypedArrayValidator.ts:84


lengthLessThan

lengthLessThan(length): TypedArrayValidator<T>

Parameters

NameType
lengthnumber

Returns

TypedArrayValidator<T>

Defined in

projects/shapeshift/src/validators/TypedArrayValidator.ts:72


lengthLessThanOrEqual

lengthLessThanOrEqual(length): TypedArrayValidator<T>

Parameters

NameType
lengthnumber

Returns

TypedArrayValidator<T>

Defined in

projects/shapeshift/src/validators/TypedArrayValidator.ts:76


lengthNotEqual

lengthNotEqual(length): TypedArrayValidator<T>

Parameters

NameType
lengthnumber

Returns

TypedArrayValidator<T>

Defined in

projects/shapeshift/src/validators/TypedArrayValidator.ts:92


lengthRange

lengthRange(start, endBefore): TypedArrayValidator<T>

Parameters

NameType
startnumber
endBeforenumber

Returns

TypedArrayValidator<T>

Defined in

projects/shapeshift/src/validators/TypedArrayValidator.ts:96


lengthRangeExclusive

lengthRangeExclusive(startAfter, endBefore): TypedArrayValidator<T>

Parameters

NameType
startAfternumber
endBeforenumber

Returns

TypedArrayValidator<T>

Defined in

projects/shapeshift/src/validators/TypedArrayValidator.ts:104


lengthRangeInclusive

lengthRangeInclusive(startAt, endAt): TypedArrayValidator<T>

Parameters

NameType
startAtnumber
endAtnumber

Returns

TypedArrayValidator<T>

Defined in

projects/shapeshift/src/validators/TypedArrayValidator.ts:100


or

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

Type parameters

Name
O

Parameters

NameType
...predicatesreadonly BaseValidator<O>[]

Returns

UnionValidator<T | O>

Inherited from

BaseValidator.or

Defined in

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


parse

parse(value): T

Parameters

NameType
valueunknown

Returns

T

Inherited from

BaseValidator.parse

Defined in

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


run

run(value): Result<T, BaseError>

Parameters

NameType
valueunknown

Returns

Result<T, BaseError>

Inherited from

BaseValidator.run

Defined in

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


transform

transform(cb): TypedArrayValidator<T>

Parameters

NameType
cb(value: T) => T

Returns

TypedArrayValidator<T>

Inherited from

BaseValidator.transform

Defined in

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

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

Type parameters

Name
O

Parameters

NameType
cb(value: T) => O

Returns

BaseValidator<O>

Inherited from

BaseValidator.transform

Defined in

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