JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 14
  • Score
    100M100P100Q54160F
  • License MIT

Essential Zod validators for Iranian specific data (National Code, Card Number, Mobile)

Package Exports

  • zod-ir

Readme

Zod Iranian Utils

npm version npm bundle size license

A lightweight, type-safe Zod extension for validating Iranian specific data. Compatible with React Hook Form, Next.js, and Node.js backends.

Features ✨

  • National Code (Code Melli): Validates using the official checksum algorithm.
  • 💳 Bank Card: Validates 16-digit card numbers using the Luhn algorithm.
  • 📱 Mobile Number: Validates Iranian mobile formats (09xx, +989xx, 9xx).
  • 🌍 Bilingual: Built-in error messages in Persian (Farsi) and English.
  • 🌲 Tree-shakable: Import only what you need.
  • 🛡️ Zero Dependency: (Only requires zod as a peer dependency).

Installation 📦

You need to install zod and zod-ir:

npm install zod zod-ir
# or
yarn add zod zod-ir
# or
pnpm add zod zod-ir