@modular-forms/solid
Version:
The modular and type-safe form library for SolidJS
12 lines (11 loc) • 344 B
JavaScript
/**
* Creates a validation functions that validates the range of a string, number or date.
*
* @param requirement The maximum range.
* @param error The error message.
*
* @returns A validation function.
*/
export function maxRange(requirement, error) {
return (value) => (value || value === 0) && value > requirement ? error : '';
}