Skip to content

Latest commit

 

History

History
90 lines (46 loc) · 1.93 KB

Adapter.md

File metadata and controls

90 lines (46 loc) · 1.93 KB

@lynxts/coreDocs


@lynxts/core / Adapter

Interface: Adapter<T>

Validation adapter for a T structure. Specifies functions required for the form validations and their hooks.

Type Parameters

T extends Struct

struct type of the form values

Properties

required()

required: (path) => boolean

Parameters

path: Path<T>

the path to check if it's requried

Returns

boolean

wether a path is required or not

Defined in

helpers/adapters.ts:30


validate()

validate: (values) => Promise<Result<T, Map<Path<T>, string>>>

Parameters

values: Partial<T>

the form values to validate

Returns

Promise<Result<T, Map<Path<T>, string>>>

a promise with the Result<S, E> of the validation

Defined in

helpers/adapters.ts:42


validateAt()

validateAt: <K>(path, value) => Promise<Result<true, string>>

Type Parameters

K extends string

Parameters

path: K

the path on the schema to validate

value: Optional<ValueByPath<T, K>>

the value to validate against

Returns

Promise<Result<true, string>>

a promise with the Result<S, E> of the validation

Defined in

helpers/adapters.ts:55