UNPKG

@modular-forms/qwik

Version:

The modular and type-safe form library for Qwik

20 lines (19 loc) 524 B
import { $, implicit$FirstArg } from '@builder.io/qwik'; /** * See {@link custom$} */ export function customQrl(requirement, error) { return $(async (value) => (Array.isArray(value) ? value.length : value || value === 0) && !(await requirement(value)) ? error : ''); } /** * Creates a custom validation function. * * @param requirement The validation function. * @param error The error message. * * @returns A validation function. */ export const custom$ = implicit$FirstArg(customQrl);