UNPKG

@modular-forms/qwik

Version:

The modular and type-safe form library for Qwik

13 lines (12 loc) 364 B
/** * Parses a value with a Zod schema and returns the result. * * @param schema The Zod schema. * @param value The value. * * @returns The parse result. */ export async function getParsedZodSchema(schema, value) { const zodSchema = await schema.resolve(); return (typeof zodSchema === 'function' ? zodSchema() : zodSchema).safeParseAsync(value); }