5.0.0 • Published 12 months ago

cnpj v5.0.0

Weekly downloads
2,027
License
MIT
Repository
github
Last release
12 months ago

CNPJ

Format, validate and generate CNPJ numbers.

Installation

Node

npm install cnpj

or, if you are using jsr

npx jsr add @brazil/cnpj
import { validate, format, generate } from 'cnpj';

Deno

deno add @brazil/cnpj
import { validate, format, generate } from '@brazil/cnpj';

Usage

// Validation
const valid = validate('38.981.218/0001-47'); // true

// Format
const formatted = format(88415345000157) // 88.415.345/0001-57

// Generation
const generated = generate(); // randomly generated, valid CNPJ

License

MIT License © Gabriel Silva