UNPKG

@mantine/form

Version:

Mantine form management library

20 lines (18 loc) 544 B
'use client'; function superstructResolver(schema) { function structValidation(values) { const formErrors = {}; const [err] = schema.validate(values); if (!err) { return formErrors; } err.failures().forEach((fieldFailure) => { const fieldName = fieldFailure.path.join(" "); formErrors[fieldFailure.path.join(".")] = `${fieldName}: ${fieldFailure.message}`; }); return formErrors; } return structValidation; } export { superstructResolver }; //# sourceMappingURL=superstruct-resolver.mjs.map