🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@alexandrezanata/validators-core

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alexandrezanata/validators-core

100% open-source Brazilian document validators — CPF, CNPJ, CEP, IE (27 UFs), PIX, boleto, and more

latest
Source
npmnpm
Version
0.10.0-alpha.0
Version published
Maintainers
1
Created
Source

@alexandrezanata/validators-core

100% open-source Brazilian document validators (MIT).

npm: @alexandrezanata/validators-core
Repo: github.com/AlexandreZanata/doc-raiz

The unscoped name br-validators on npm is a different package. Use @alexandrezanata/validators-core.

Install

npm install @alexandrezanata/validators-core

Requires Node ≥ 18. ESM only ("type": "module").

Supported types

ModuleFunctionsGolden vector
CNPJvalidateCnpj, formatCnpj, stripCnpj12ABC34501DE35
CPFvalidateCpf, formatCpf, stripCpf12345678909
CEPvalidateCep, formatCep, stripCep01310100
PlacavalidatePlaca, formatPlaca, convertPlacaToMercosulABC1D23
PIS/PASEPvalidatePisPasep, formatPisPasep10027230888
PIX keyvalidatePixKey, formatPixKeypix@bcb.gov.br
BoletovalidateBoleto, formatBoletoSituação 1 + 2
Credit cardvalidateCartaoCredito, passesLuhn4111111111111111
IE (27 UFs)validateInscricaoEstadual, validateIeSp, …per UF — see docs

Subpath imports for tree-shaking:

import { validateCnpj } from '@alexandrezanata/validators-core/cnpj';
import { validateInscricaoEstadual } from '@alexandrezanata/validators-core/inscricao-estadual';

Examples

import { validateCnpj, formatCnpj } from '@alexandrezanata/validators-core';

const result = validateCnpj('12ABC34501DE35');
// { ok: true, value: '12ABC34501DE35', format: 'alphanumeric', ... }

formatCnpj('12ABC34501DE35');
// { ok: true, formatted: '12.ABC.345/01DE-35', ... }
import { validateInscricaoEstadual } from '@alexandrezanata/validators-core/inscricao-estadual';

validateInscricaoEstadual('110042490114', { uf: 'SP' });
validateInscricaoEstadual('0730000100109', { uf: 'DF' });

Official sources

Every algorithm cites a primary government source. Full table: OFFICIAL-SOURCES.md

Per-type URLs also available via constants (CNPJ_OFFICIAL_SOURCE_URL, IE_OFFICIAL_SOURCE_URLS, etc.).

API reference

docs/LIBRARY-API.md

CLI companion

npm install -g @alexandrezanata/validators-cli
br-validators cnpj validate 12ABC34501DE35 --json

License

MIT

Keywords

brazil

FAQs

Package last updated on 22 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts