Skip to content

Latest commit

 

History

History
41 lines (37 loc) · 1.1 KB

README.md

File metadata and controls

41 lines (37 loc) · 1.1 KB

Usage

validate

/** Validates a value against a given schema
 *
 * @param schema The schema to validate the input against
 * @param input The value to validate against the schema
 * @returns A promise that resolves true if the value validates
 *          against the schema, false otherwise
 */
type validate = (schema: Schema, input: unknown) => Promise<boolean>;

validateSchema

/** Validates a schema
 *
 * @param schema The schema to validate
 * @returns true if the input is a valid schema, false others
 */
type validateSchema = (schema: unknown) => boolean;

use

/**Validates the input against the given schema
 *
 * @param input The input to validate
 * @returns true if the input is a valid schema, false others
 */
type Validator = (input: unknown) => Promise<boolean>;

/** Returns a validator function that will validate a given input
 *  against the specified schema
 *
 * @param schema The schema that the validator will validate inputs against
 * @return A validator function that will use the given schema for validation
 */
type use = (schema: Schema) => Validator