UNPKG

@modular-forms/react

Version:

The modular and type-safe form library for React

12 lines (11 loc) 342 B
/** * Creates a validation function that checks the value of an input for equality. * * @param requirement The value to be checked. * @param error The error message. * * @returns A validation function. */ export function value(requirement, error) { return (value) => (value || value === 0) && value !== requirement ? error : ''; }