npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

zod-brasil

v1.8.0

Published

**zod-brasil** é uma biblioteca que fornece esquemas de validação para dados brasileiros, como CPF, CNPJ e RG, utilizando a poderosa biblioteca [Zod](https://github.com/colinhacks/zod).

Readme

zod-brasil

zod-brasil é uma biblioteca que fornece esquemas de validação para dados brasileiros, como CPF, CNPJ e RG, utilizando a poderosa biblioteca Zod.

Recursos

  • Validação de CPF: Verifica se o CPF é válido, incluindo a checagem dos dígitos verificadores.
  • Validação de CNPJ: Verifica se o CNPJ é válido, incluindo a checagem dos dígitos verificadores.
  • Validação de RG: Valida o formato do RG conforme padrões comuns.

Instalação

Instale o pacote via npm:

npm install zod-brasil

Ou via yarn:

yarn add zod-brasil

Uso

Importe os esquemas de validação necessários e utilize-os em seu projeto:

import { cpfSchema, cnpjSchema, rgSchema, pessoaSchema } from 'zod-brasil';

// Exemplo de validação de CPF
const cpfResult = cpfSchema.safeParse('123.456.789-09');
if (!cpfResult.success) {
  console.error(cpfResult.error.format());
} else {
  console.log('CPF válido:', cpfResult.data);
}

// Exemplo de validação de CNPJ
const cnpjResult = cnpjSchema.safeParse('12.345.678/0001-95');
if (!cnpjResult.success) {
  console.error(cnpjResult.error.format());
} else {
  console.log('CNPJ válido:', cnpjResult.data);
}

// Exemplo de validação de uma pessoa
const pessoaResult = pessoaSchema.safeParse({
  nome: 'João Silva',
  cpf: '123.456.789-09',
  cnpj: '12.345.678/0001-95',
  rg: '12.345.678-9',
});

if (!pessoaResult.success) {
  console.error(pessoaResult.error.format());
} else {
  console.log('Dados válidos:', pessoaResult.data);
}

Esquemas Disponíveis

  • cpfSchema: Valida strings no formato de CPF (000.000.000-00).
  • cnpjSchema: Valida strings no formato de CNPJ (00.000.000/0000-00).
  • rgSchema: Valida strings no formato de RG (00.000.000-0).
  • pessoaSchema: Valida um objeto que contém nome, cpf, cnpj (opcional) e rg (opcional).

Contribuição

Contribuições são bem-vindas! Sinta-se à vontade para abrir issues e pull requests no repositório do GitHub.

Licença

Este projeto está licenciado sob a MIT License.