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 - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

2

package.json
{
"name": "validator-brazil",
"version": "1.2.0",
"version": "1.2.1",
"description": "validacao de cpf e cnpj",

@@ -5,0 +5,0 @@ "main": "src/index.js",

# validator-brazil
Este módulo permite a validação de CPF e CNPJ. Documentos unicamente brasileiros.
With this module, you can validate the CPF and CNPJ numbers. Documents only Brazilian.

@@ -5,0 +5,0 @@ [![npm version](https://badge.fury.io/js/validator-brazil.svg)](https://badge.fury.io/js/validator-brazil)

@@ -0,0 +0,0 @@ /**

@@ -87,4 +87,4 @@ var regex = /[\.\-\/]+/g;

cep = cep.replace(regex, "");
var cepRegex = /^[1-9]{1}[0-9]{7}$/g;
var cepRegex = /^[0-9]{8}$/g;
return cepRegex.test(cep);
};

@@ -5,16 +5,20 @@ import { isCep } from "../index";

it("should return true to valid cep without hyphen", () => {
expect(isCep("14710130")).toEqual(true);
expect(isCep("14710130")).toBeTruthy();
});
it("should return false to invalid cep with 0 in the initial", () => {
expect(isCep("04710130")).toEqual(false);
it("should return true to invalid cep with 0 in the initial", () => {
expect(isCep("04710130")).toBeTruthy();
});
it("should return true to valid cep with hyphen", () => {
expect(isCep("54710-130")).toEqual(true);
it("should return true to valid cep WITH hyphen", () => {
expect(isCep("54710-130")).toBeTruthy();
});
it("should return true to valid cep WITHOUT hyphen", () => {
expect(isCep("54710130")).toBeTruthy();
});
it("should return false to invalid cep", () => {
expect(isCep("5471012023")).toEqual(false);
expect(isCep("5471012023")).toBeFalsy()
});
});

@@ -5,20 +5,20 @@ import { isCnpj } from "../index";

it("should return true to valid cnpj without hyphen and points", () => {
expect(isCnpj("00933180000164")).toEqual(true);
expect(isCnpj("00933180000164")).toBeTruthy();
});
it("should return true to valid cnpj with hyphen and points", () => {
expect(isCnpj("00.933.180/0001-64")).toEqual(true);
expect(isCnpj("00.933.180/0001-64")).toBeTruthy();
});
it("should return false with letters", () => {
expect(isCnpj("00933180000164a")).toEqual(false);
expect(isCnpj("00933180000164a")).toBeFalsy();
});
it("should return false to invalid cnpj with hyphen and points", () => {
expect(isCnpj("001112220000133")).toEqual(false);
expect(isCnpj("001112220000133")).toBeFalsy();
});
it("should return false to invalid cnpj", () => {
expect(isCnpj("00000000000000")).toEqual(false);
expect(isCnpj("00000000000000")).toBeFalsy();
});
});

@@ -5,20 +5,20 @@ import { isCpf } from "../index";

it("should return true to valid cpf wythout hyphen and points", () => {
expect(isCpf("14552586017")).toEqual(true);
expect(isCpf("14552586017")).toBeTruthy();
});
it("should return true to valid cpf with hyphen and points", () => {
expect(isCpf("145.525.860-17")).toEqual(true);
expect(isCpf("145.525.860-17")).toBeTruthy();
});
it("should return false with letters", () => {
expect(isCpf("14552586017a")).toEqual(false);
expect(isCpf("14552586017a")).toBeFalsy();
});
it("should return false to invalid cpf wythout hyphen and points", () => {
expect(isCpf("00011122233")).toEqual(false);
expect(isCpf("00011122233")).toBeFalsy();
});
it("should return false to invalid cpf with hyphen and points", () => {
expect(isCpf("000.111.222-33")).toEqual(false);
expect(isCpf("000.111.222-33")).toBeFalsy();
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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