UNPKG

@modular-forms/solid

Version:

The modular and type-safe form library for SolidJS

13 lines (12 loc) 311 B
/** * Creates a validation function that checks the existence of an input. * * @param error The error message. * * @returns A validation function. */ export function required(error) { return (value) => (!value && value !== 0) || (Array.isArray(value) && !value.length) ? error : ''; }