Skip to main content

Class: Shapes

Constructors

new Shapes()

new Shapes(): Shapes

Returns

Shapes

Methods

any()

any(options?: ValidatorOptions): PassthroughValidator<any>

Parameters

ParameterType
options?ValidatorOptions

Returns

PassthroughValidator<any>

Defined in

projects/shapeshift/src/lib/Shapes.ts:66


array()

array(validator, options)

array<T>(validator: BaseValidator<T>, options?: ValidatorOptions): ArrayValidator<T[], T>

Type Parameters
Type Parameter
T
Parameters
ParameterType
validatorBaseValidator<T>
options?ValidatorOptions
Returns

ArrayValidator<T[], T>

Defined in

projects/shapeshift/src/lib/Shapes.ts:105

array(validator, options)

array<T>(validator: BaseValidator<T[number]>, options?: ValidatorOptions): ArrayValidator<T, T[number]>

Type Parameters
Type Parameter
T extends unknown[]
Parameters
ParameterType
validatorBaseValidator<T[number]>
options?ValidatorOptions
Returns

ArrayValidator<T, T[number]>

Defined in

projects/shapeshift/src/lib/Shapes.ts:106


bigInt64Array()

bigInt64Array(options?: ValidatorOptions): TypedArrayValidator<BigInt64Array>

Parameters

ParameterType
options?ValidatorOptions

Returns

TypedArrayValidator<BigInt64Array>

Defined in

projects/shapeshift/src/lib/Shapes.ts:151


bigUint64Array()

bigUint64Array(options?: ValidatorOptions): TypedArrayValidator<BigUint64Array>

Parameters

ParameterType
options?ValidatorOptions

Returns

TypedArrayValidator<BigUint64Array>

Defined in

projects/shapeshift/src/lib/Shapes.ts:155


bigint()

bigint(options?: ValidatorOptions): BigIntValidator<bigint>

Parameters

ParameterType
options?ValidatorOptions

Returns

BigIntValidator<bigint>

Defined in

projects/shapeshift/src/lib/Shapes.ts:38


boolean()

boolean(options?: ValidatorOptions): BooleanValidator<boolean>

Parameters

ParameterType
options?ValidatorOptions

Returns

BooleanValidator<boolean>

Defined in

projects/shapeshift/src/lib/Shapes.ts:42


date()

date(options?: ValidatorOptions): DateValidator

Parameters

ParameterType
options?ValidatorOptions

Returns

DateValidator

Defined in

projects/shapeshift/src/lib/Shapes.ts:46


enum()

enum<T>(values: readonly T[], options?: ValidatorOptions): UnionValidator<T>

Type Parameters

Type Parameter
T

Parameters

ParameterType
valuesreadonly T[]
options?ValidatorOptions

Returns

UnionValidator<T>

Defined in

projects/shapeshift/src/lib/Shapes.ts:78


float32Array()

float32Array(options?: ValidatorOptions): TypedArrayValidator<Float32Array>

Parameters

ParameterType
options?ValidatorOptions

Returns

TypedArrayValidator<Float32Array>

Defined in

projects/shapeshift/src/lib/Shapes.ts:143


float64Array()

float64Array(options?: ValidatorOptions): TypedArrayValidator<Float64Array>

Parameters

ParameterType
options?ValidatorOptions

Returns

TypedArrayValidator<Float64Array>

Defined in

projects/shapeshift/src/lib/Shapes.ts:147


instance()

instance<T>(expected: Constructor<T>, options?: ValidatorOptions): InstanceValidator<T>

Type Parameters

Type Parameter
T

Parameters

ParameterType
expectedConstructor<T>
options?ValidatorOptions

Returns

InstanceValidator<T>

Defined in

projects/shapeshift/src/lib/Shapes.ts:97


int16Array()

int16Array(options?: ValidatorOptions): TypedArrayValidator<Int16Array>

Parameters

ParameterType
options?ValidatorOptions

Returns

TypedArrayValidator<Int16Array>

Defined in

projects/shapeshift/src/lib/Shapes.ts:127


int32Array()

int32Array(options?: ValidatorOptions): TypedArrayValidator<Int32Array>

Parameters

ParameterType
options?ValidatorOptions

Returns

TypedArrayValidator<Int32Array>

Defined in

projects/shapeshift/src/lib/Shapes.ts:135


int8Array()

int8Array(options?: ValidatorOptions): TypedArrayValidator<Int8Array>

Parameters

ParameterType
options?ValidatorOptions

Returns

TypedArrayValidator<Int8Array>

Defined in

projects/shapeshift/src/lib/Shapes.ts:115


lazy()

lazy<T>(validator: (value: unknown) => T, options?: ValidatorOptions): LazyValidator<T, Unwrap<T>>

Type Parameters

Type Parameter
T extends BaseValidator<unknown>

Parameters

ParameterType
validator(value: unknown) => T
options?ValidatorOptions

Returns

LazyValidator<T, Unwrap<T>>

Defined in

projects/shapeshift/src/lib/Shapes.ts:175


literal()

literal<T>(value: T, options?: object): BaseValidator<T>

Type Parameters

Type Parameter
T

Parameters

ParameterType
valueT
options?object
options.dateOptions?ValidatorOptions
options.equalsOptions?ValidatorOptions

Returns

BaseValidator<T>

Defined in

projects/shapeshift/src/lib/Shapes.ts:89


map()

map<T, U>(keyValidator: BaseValidator<T>, valueValidator: BaseValidator<U>, options?: ValidatorOptions): MapValidator<T, U>

Type Parameters

Type Parameter
T
U

Parameters

ParameterType
keyValidatorBaseValidator<T>
valueValidatorBaseValidator<U>
options?ValidatorOptions

Returns

MapValidator<T, U>

Defined in

projects/shapeshift/src/lib/Shapes.ts:171


nativeEnum()

nativeEnum<T>(enumShape: T, options?: ValidatorOptions): NativeEnumValidator<T>

Type Parameters

Type Parameter
T extends NativeEnumLike

Parameters

ParameterType
enumShapeT
options?ValidatorOptions

Returns

NativeEnumValidator<T>

Defined in

projects/shapeshift/src/lib/Shapes.ts:85


never()

never(options?: ValidatorOptions): NeverValidator

Parameters

ParameterType
options?ValidatorOptions

Returns

NeverValidator

Defined in

projects/shapeshift/src/lib/Shapes.ts:74


null()

null(options?: ValidatorOptions): BaseValidator<null>

Parameters

ParameterType
options?ValidatorOptions

Returns

BaseValidator<null>

Defined in

projects/shapeshift/src/lib/Shapes.ts:58


nullish()

nullish(options?: ValidatorOptions): NullishValidator

Parameters

ParameterType
options?ValidatorOptions

Returns

NullishValidator

Defined in

projects/shapeshift/src/lib/Shapes.ts:62


number()

number(options?: ValidatorOptions): NumberValidator<number>

Parameters

ParameterType
options?ValidatorOptions

Returns

NumberValidator<number>

Defined in

projects/shapeshift/src/lib/Shapes.ts:34


object()

object<T>(shape: MappedObjectValidator<T>, options?: ValidatorOptions): ObjectValidator<T, UndefinedToOptional<T>>

Type Parameters

Type Parameter
T extends object

Parameters

ParameterType
shapeMappedObjectValidator<T>
options?ValidatorOptions

Returns

ObjectValidator<T, UndefinedToOptional<T>>

Defined in

projects/shapeshift/src/lib/Shapes.ts:50


record()

record<T>(validator: BaseValidator<T>, options?: ValidatorOptions): RecordValidator<T>

Type Parameters

Type Parameter
T

Parameters

ParameterType
validatorBaseValidator<T>
options?ValidatorOptions

Returns

RecordValidator<T>

Defined in

projects/shapeshift/src/lib/Shapes.ts:167


set()

set<T>(validator: BaseValidator<T>, options?: ValidatorOptions): SetValidator<T>

Type Parameters

Type Parameter
T

Parameters

ParameterType
validatorBaseValidator<T>
options?ValidatorOptions

Returns

SetValidator<T>

Defined in

projects/shapeshift/src/lib/Shapes.ts:163


string()

string(options?: ValidatorOptions): StringValidator<string>

Parameters

ParameterType
options?ValidatorOptions

Returns

StringValidator<string>

Defined in

projects/shapeshift/src/lib/Shapes.ts:30


tuple()

tuple<T>(validators: [...T[]], options?: ValidatorOptions): TupleValidator<UnwrapTuple<T>>

Type Parameters

Type Parameter
T extends BaseValidator<any>[]

Parameters

ParameterType
validators[...T[]]
options?ValidatorOptions

Returns

TupleValidator<UnwrapTuple<T>>

Defined in

projects/shapeshift/src/lib/Shapes.ts:159


typedArray()

typedArray<T>(type: "Int8Array" | "Uint8Array" | "Uint8ClampedArray" | "Int16Array" | "Uint16Array" | "Int32Array" | "Uint32Array" | "Float32Array" | "Float64Array" | "BigInt64Array" | "BigUint64Array" | "TypedArray", options?: ValidatorOptions): TypedArrayValidator<T>

Type Parameters

Type Parameter
T extends TypedArray

Parameters

ParameterTypeDefault value
type"Int8Array" | "Uint8Array" | "Uint8ClampedArray" | "Int16Array" | "Uint16Array" | "Int32Array" | "Uint32Array" | "Float32Array" | "Float64Array" | "BigInt64Array" | "BigUint64Array" | "TypedArray"'TypedArray'
options?ValidatorOptionsundefined

Returns

TypedArrayValidator<T>

Defined in

projects/shapeshift/src/lib/Shapes.ts:111


uint16Array()

uint16Array(options?: ValidatorOptions): TypedArrayValidator<Uint16Array>

Parameters

ParameterType
options?ValidatorOptions

Returns

TypedArrayValidator<Uint16Array>

Defined in

projects/shapeshift/src/lib/Shapes.ts:131


uint32Array()

uint32Array(options?: ValidatorOptions): TypedArrayValidator<Uint32Array>

Parameters

ParameterType
options?ValidatorOptions

Returns

TypedArrayValidator<Uint32Array>

Defined in

projects/shapeshift/src/lib/Shapes.ts:139


uint8Array()

uint8Array(options?: ValidatorOptions): TypedArrayValidator<Uint8Array>

Parameters

ParameterType
options?ValidatorOptions

Returns

TypedArrayValidator<Uint8Array>

Defined in

projects/shapeshift/src/lib/Shapes.ts:119


uint8ClampedArray()

uint8ClampedArray(options?: ValidatorOptions): TypedArrayValidator<Uint8ClampedArray>

Parameters

ParameterType
options?ValidatorOptions

Returns

TypedArrayValidator<Uint8ClampedArray>

Defined in

projects/shapeshift/src/lib/Shapes.ts:123


undefined()

undefined(options?: ValidatorOptions): BaseValidator<undefined>

Parameters

ParameterType
options?ValidatorOptions

Returns

BaseValidator<undefined>

Defined in

projects/shapeshift/src/lib/Shapes.ts:54


union()

union<T>(validators: T, options?: ValidatorOptions): UnionValidator<Unwrap<T[number]>>

Type Parameters

Type Parameter
T extends BaseValidator<any>[]

Parameters

ParameterType
validatorsT
options?ValidatorOptions

Returns

UnionValidator<Unwrap<T[number]>>

Defined in

projects/shapeshift/src/lib/Shapes.ts:101


unknown()

unknown(options?: ValidatorOptions): PassthroughValidator<unknown>

Parameters

ParameterType
options?ValidatorOptions

Returns

PassthroughValidator<unknown>

Defined in

projects/shapeshift/src/lib/Shapes.ts:70