UNPKG

@modular-forms/qwik

Version:

The modular and type-safe form library for Qwik

19 lines (18 loc) 490 B
import { setError } from '../methods'; /** * Sets the errors for the respective fields. * * @param form The form of the fields. * @param errors The errors of the fields. * @param options The error options. */ export function setFieldErrors(form, errors, options) { Object.entries(errors).forEach(([name, error]) => { if (error) { setError(form, name, error, { ...options, shouldFocus: false, }); } }); }