validator-brazil
With this module, you can validate the CPF, CNPJ and CEP numbers. Documents only Brazilian.
Getting started
Install with NPM
$ npm install validator-brazil --save
Install with Yarn
$ yarn add validator-brazil
How to use with ES6
CPF
import { isCpf } from "validator-brazil";
isCpf("29018170097");
isCpf("12312345600");
isCpf("123.123.456-00");
CNPJ
import { isCnpj, isCpf, isCep } from "validator-brazil";
isCnpj("54334068000136");
isCnpj("00111222000100");
isCnpj("54.334.068/0001-36");
CEP
import { isCep } from "validator-brazil";
isCep("43710130");
isCep("5471013423");
isCep("43710-130");
How to use with ES5
const validator = require("validator-brazil");
validator.isCnpj("54334068000136");
validator.isCnpj("00111222000100");
validator.isCpf("29018170097");
validator.isCpf("12312345600");
validator.isCnpj("54.334.068/0001-36");
validator.isCpf("123.123.456-00");