br-docs-validator
v0.2.0
Published
CPF and CNPJ validator
Downloads
30
Readme
CPF and CNPJ validator
Installation
npm install br-docs-validator
Usage
import { cpf, cnpj, generic } from "br-docs-validator";
// validates a cpf (with or without punctuation)
const cpfIsValid = cpf.isValid("438.592.280-21");
// #=> true
// validates a cnpj (with or without punctuation)
const cnpjIsValid = cnpj.isValid("79.402.591/0001-83");
// #=> true
// validates the cpf or cnpj depending on the length of the string (can be with or without punctuation)
const cnpjOrCpfIsValid = generic.isValid("79.402.591/0001-83");
// #=> true
License
Copyright (c) 2024