UNPKG

auto-form-validator

Version:

A smart, zero-setup form validation library for React with automatic rule detection, i18n support, async validation, and UI integration helpers.

17 lines (15 loc) 836 B
/** * Creates an async validator that checks username availability. * * @param checkFn - A function that returns a Promise resolving to `true` if available, else `false`. * @param message - Optional custom error message. */ declare const createUsernameAvailableValidator: (checkFn: (username: string) => Promise<boolean>, message?: string) => (username: string) => Promise<string | null>; /** * Creates an async validator that validates email domain against a list of allowed domains. * * @param allowedDomains - List of allowed email domains (e.g., ["gmail.com"]). * @param message - Optional custom error message. */ declare const createEmailDomainValidator: (allowedDomains: string[], message?: string) => (email: string) => Promise<string | null>; export { createEmailDomainValidator, createUsernameAvailableValidator };