apphouse
Version:
Component library for React that uses observable state management and theme-able components.
21 lines (20 loc) • 535 B
TypeScript
/**
* Helper function to validate a field.
* @param value the value of the field
* @param required whether the field is required or not
* @param validation the validation function for the field
* @returns boolean if true, the field is valid, otherwise it is not
*/
export declare function validateField<T>(
/**
* The value of the field.
*/
value: any,
/**
* Whether the field is required or not.
*/
required: boolean,
/**
* A function to validate the value of the field.
*/
validation?: (value?: T) => boolean): boolean;