@modular-forms/preact
Advanced tools
Comparing version 0.6.1 to 0.6.2
@@ -10,10 +10,5 @@ /** | ||
return async (value) => { | ||
try { | ||
await schema.parse(value, { abortPipeEarly: true }); | ||
return ''; | ||
} | ||
catch (error) { | ||
return error.message; | ||
} | ||
const result = await schema._parse(value, { abortPipeEarly: true }); | ||
return result.issues?.[0]?.message || ''; | ||
}; | ||
} |
@@ -10,13 +10,10 @@ /** | ||
return async (values) => { | ||
try { | ||
await schema.parse(values, { abortPipeEarly: true }); | ||
return {}; | ||
} | ||
catch (error) { | ||
return error.issues.reduce((errors, issue) => ({ | ||
const result = await schema._parse(values, { abortPipeEarly: true }); | ||
return result.issues | ||
? result.issues.reduce((errors, issue) => ({ | ||
...errors, | ||
[issue.path.map(({ key }) => key).join('.')]: issue.message, | ||
}), {}); | ||
} | ||
}), {}) | ||
: {}; | ||
}; | ||
} |
{ | ||
"name": "@modular-forms/preact", | ||
"description": "The modular and type-safe form library for Preact", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"license": "MIT", | ||
@@ -53,3 +53,3 @@ "author": "Fabian Hiller", | ||
"typescript": "4.9.5", | ||
"valibot": "^0.8.0", | ||
"valibot": "^0.13.1", | ||
"vite": "^4.4.3", | ||
@@ -56,0 +56,0 @@ "zod": "^3.21.4" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
290097
7654