UNPKG

slimeform

Version:

Form state management and validation for Vue3

25 lines (23 loc) 509 B
import "./chunk-GONKA3OC.js"; // packages/resolvers/yup.ts function yupFieldRule(fieldSchema, schemaOptions = {}) { return (val) => { try { fieldSchema.validateSync( val, Object.assign({ abortEarly: false }, schemaOptions) ); return true; } catch (error) { if (!(error == null ? void 0 : error.inner)) throw error; return parseYupError(error); } }; } function parseYupError(error) { return error.errors[0]; } export { yupFieldRule };