TupleValidator

Hierarchy

Implements

Index

Properties

Methods

Properties

Static describer

describer: Describer

Inherited from PatternValidator.describer

Overrides void

Methods

canValidate

canValidate(expectation: Expectation): boolean

Evaluates if validator can handle provided explicit pattern or implicit expectation.

Parameters:

NameTypeDescription
expectationExpectationEvaluated explicit Pattern instance or implicit expectation.

Returns: boolean

Returns true if pattern is instance of Tuple or expectation matches array with value or its Array constructor, else false.


describe

describe(value: any): string

Inherited from PatternValidator.describe

Overrides void

Parameters:

NameType
valueany

Returns: string


validate

validate(value: any, tupleOrExpect: Tuple | [], validator: Validator): boolean

Validates if value matches pattern expectation.

throws {InvalidTypeError} Thrown if the value is not an array.

throws {NotAMemberError} Thrown if the value does not match provided pattern expectation.

Parameters:

NameTypeDescription
valueanyValue that is validated against expectation.
tupleOrExpectTuple | []Explicit pattern as Tuple instance or implicit expectation against which value is validated.
validatorValidatorValidator matching Validator interface.

Returns: boolean

Returns true if value is matching tuple expectation, else throws.


Static getDescriber

getDescriber(): Describer

Inherited from PatternValidator.getDescriber

Overrides void

Returns: Describer


Static setDescriber

setDescriber(describer: Describer): void

Inherited from PatternValidator.setDescriber

Overrides void

Parameters:

NameType
describerDescriber

Returns: void