@br-validators/zod
v1.8.2
Published
Zod schemas for Brazilian document validators — delegates to @br-validators/core
Maintainers
Readme
@br-validators/zod
Zod schemas that delegate to @br-validators/core v1.8.2 validate* functions — same golden vectors, same error messages.
Install
pnpm add @br-validators/zod @br-validators/core zodPeer dependency: zod ^3.23.0 || ^4.0.0
Usage
import { z } from 'zod';
import { cpfSchema, telefoneSchema } from '@br-validators/zod';
const formSchema = z.object({
cpf: cpfSchema,
telefone: telefoneSchema,
});
formSchema.parse({
cpf: '123.456.789-09',
telefone: '(11) 99999-9999',
});Exports
| Schema | Output |
|--------|--------|
| cpfSchema | canonical string |
| cnpjSchema | canonical string |
| cepSchema | canonical string |
| telefoneSchema | { value, tipo } |
| placaSchema | { value, format } |
| pisPasepSchema / pisSchema | canonical string |
| pixKeySchema | { value, keyType } |
| boletoSchema | { value, inputKind, situacao } |
| cartaoCreditoSchema | { value, brand } |
| createInscricaoEstadualSchema({ uf }) | { value, uf } |
Subpath imports mirror core: @br-validators/zod/cpf, etc.
License
MIT
