Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

validator-brazil

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

validator-brazil

validacao de cpf e cnpj

  • 1.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
469
decreased by-36.54%
Maintainers
1
Weekly downloads
 
Created
Source

validator-brazil

With this module, you can validate the CPF and CNPJ numbers. Documents only Brazilian.

npm version

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";

// No points or hyphens
isCpf("29018170097"); // false
isCpf("12312345600"); // false

// With points or hyphens
isCpf("123.123.456-00"); // false
CNPJ
import { isCnpj, isCpf, isCep } from "validator-brazil";

// No points or hyphens
isCnpj("54334068000136"); // true
isCnpj("00111222000100"); // false

// With points or hyphens
isCnpj("54.334.068/0001-36"); // true
CEP
import { isCep } from "validator-brazil";

// No points or hyphens
isCep("43710130"); // true
isCep("5471013423"); // false

// With points or hyphens
isCep("43710-130"); // true
How to use with ES5
const validator = require("validator-brazil");

// No points or hyphens
validator.isCnpj("54334068000136"); // true
validator.isCnpj("00111222000100"); // false
validator.isCpf("29018170097"); // true
validator.isCpf("12312345600"); // false

// With points or hyphens
validator.isCnpj("54.334.068/0001-36"); // true
validator.isCpf("123.123.456-00"); // false

Keywords

FAQs

Package last updated on 10 Jan 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc