Skip to main content

Built and signed on GitHub Actions

Validate forms with ease using Zod and get user-friendly error messages or valid typed data, compatible with any framework on both server and client side.

This package works with Bun, Node.js, Deno, BrowsersIt is unknown whether this package works with Cloudflare Workers
JSR Score
100%
Published
3 months ago (2.0.0)
function parseForm

Parse form data using a Zod schema and return a friendly key-value dict of errors

Examples

Example 1

""" const schema = z.object({ email: z.string().email(), password: z.string().min(8), }); const data = { email: "jason", password: "12345678" }; const { validData, errors } = parseForm({ schema, data }); """

Parameters

  • The parameters for the form parsing.
optional
options: { stripEmptyStrings?: boolean; }
  • Additional options for the form parsing.

Return Type

ParseFormResult<params.schema>

The result of the form parsing.

Add Package

deno add @jmondi/zod-friendly-forms

Import symbol

import { parseForm } from "@jmondi/zod-friendly-forms";

Add Package

npx jsr add @jmondi/zod-friendly-forms

Import symbol

import { parseForm } from "@jmondi/zod-friendly-forms";

Add Package

yarn dlx jsr add @jmondi/zod-friendly-forms

Import symbol

import { parseForm } from "@jmondi/zod-friendly-forms";

Add Package

pnpm dlx jsr add @jmondi/zod-friendly-forms

Import symbol

import { parseForm } from "@jmondi/zod-friendly-forms";

Add Package

bunx jsr add @jmondi/zod-friendly-forms

Import symbol

import { parseForm } from "@jmondi/zod-friendly-forms";