npm.io
1.10.0 • Published yesterday

@br-validators/zod

Licence
MIT
Version
1.10.0
Deps
1
Size
28 kB
Vulns
0
Weekly
0
Stars
5

@br-validators/zod

npm MIT GitHub release

Zod schemas that delegate to @br-validators/core v1.10.0 validate* functions — same golden vectors, same error messages.

Install

pnpm add @br-validators/zod @br-validators/core zod

Peer 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

Keywords