(schema: z.ZodTypeAny)
| 1 | import { z } from 'zod' |
| 2 | |
| 3 | export const validateSchema = (schema: z.ZodTypeAny) => (input: unknown) => { |
| 4 | const result = schema.safeParse(input) |
| 5 | if (!result.success) { |
| 6 | return { value: undefined, error: (result as z.SafeParseError<unknown>).error } |
| 7 | } |
| 8 | return { value: result.data, error: undefined } |
| 9 | } |
| 10 | |
| 11 | export const attemptValidation = (schema: z.ZodTypeAny) => (input: unknown) => schema.parse(input) |
no outgoing calls
no test coverage detected