Skip to content

AIDC Toolkit / Utility / RecordValidator

Class: RecordValidator<T>

Defined in: record.ts:11

Record validator. Validation is performed against a record with a string key type and throws an error if the key is not found.

Type Parameters

T

T

Property type.

Implements

Constructors

Constructor

new RecordValidator<T>(typeName, record): RecordValidator<T>

Defined in: record.ts:31

Constructor.

Parameters

typeName

string

Type name for error message.

record

Readonly<Record<string, T>>

Record in which to look up keys.

Returns

RecordValidator<T>

Accessors

typeName

Get Signature

get typeName(): string

Defined in: record.ts:39

Get the type name.

Returns

string


record

Get Signature

get record(): Readonly<Record<string, T>>

Defined in: record.ts:46

Get the record.

Returns

Readonly<Record<string, T>>

Methods

validate()

validate(key): void

Defined in: record.ts:56

Validate a key by looking it up in the record.

Parameters

key

string

Record key.

Returns

void

Implementation of

StringValidator.validate