Skip to content

andrebenedetti/cpf-cnpj-validator

 
 

Repository files navigation

cpf-cnpj-validator

Fork and rewrite of cpf-cnpj-validator with only essential code to validate CPFs and CNPJs.

Fork e reescrita somente com código essencial para validar CPFs e CNPJs.

MIT

Installation

npm i @andrebenedetti/cpf-cnpj-validator

Usage

import { isValidCnpj, isValidCpf } from "@andrebenedetti/cpf-cnpj-validator";

isValidCnpj("12345678901234");
isValidCpf("12345678901");

Notes on validation

All non-numeric characters will be removed before validation. For instance, this will return true:

isValidCpf("20@923##%14@!8,230"); // returns true

About

Valida e formata strings de CPF ou CNPJ.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 69.6%
  • JavaScript 30.4%