New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cpf_and_cnpj-validator

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cpf_and_cnpj-validator

This repository contains a JavaScript code that validates a valid Brazilian CPF (Cadastro de Pessoas Físicas) and CNPJ. CPF is a unique identification number assigned to individuals in Brazil. The code ensures that the generated CPF numbers follow the req

  • 0.0.2
  • npm
  • Socket score

Version published
Weekly downloads
24
decreased by-52%
Maintainers
0
Weekly downloads
 
Created
Source

CPF and CNPJ Validator / Validador de CPF e CNPJ

npm version License: MIT npm downloads

Este pacote npm fornece funções em JavaScript para gerar números válidos de CPF (Cadastro de Pessoas Físicas) e CNPJ (Cadastro Nacional da Pessoa Jurídica) para o Brasil.

Você também pode usar o gerador - https://www.npmjs.com/package/cpf_and_cnpj-generator

Instalação

Você pode instalar este pacote usando npm:

npm install cpf_and_cnpj-validator

ou usando yarn:

yarn add cpf_and_cnpj-validator

Como Usar

Após instalar o pacote, você pode utilizá-lo em seu projeto JavaScript:

// Usando import
import gerador from "cpf_and_cnpj-validator";

console.log(gerador.cnpjIsValid("12.345.678/0001-95")); // true
console.log(gerador.cnpjIsValid("12.345.678/0001-00")); // false
console.log(gerador.cpfIsValid("123.456.789-09")); // true
console.log(gerador.cpfIsValid("123.456.789-00")); // false

// Ou
import { cnpjIsValid, cpfIsValid } from "cpf_and_cnpj-validator";

console.log(cnpjIsValid("12.345.678/0001-95")); // true
console.log(cnpjIsValid("12.345.678/0001-00")); // false
console.log(cpfIsValid("123.456.789-09")); // true
console.log(cpfIsValid("123.456.789-00")); // false

// Usando require
const gerador = require("cpf_and_cnpj-validator");

console.log("CNPJ Válido:", gerador.cnpjIsValid("12.345.678/0001-95")); // true
console.log("CNPJ Inválido:", gerador.cnpjIsValid("12.345.678/0001-00")); // false
console.log("CPF Válido:", gerador.cpfIsValid("123.456.789-09")); // true
console.log("CPF Inválido:", gerador.cpfIsValid("123.456.789-00")); // false

// Ou
const { cpfIsValid, cnpjIsValid } = require("cpf_and_cnpj-validator");

console.log("CNPJ Válido:", cnpjIsValid("12.345.678/0001-95")); // true
console.log("CNPJ Inválido:", cnpjIsValid("12.345.678/0001-00")); // false
console.log("CPF Válido:", cpfIsValid("123.456.789-09")); // true
console.log("CPF Inválido:", cpfIsValid("123.456.789-00")); // false

If you want to help me, you can buy me a coffee (:

Buy Me A Coffee

Lembre-se de que o código de importação ou require depende do ambiente JavaScript em que você está executando o pacote (por exemplo, Node.js com suporte a módulos ES ou sem suporte). Portanto, escolha a opção de importação ou require adequada ao seu ambiente.

Keywords

FAQs

Package last updated on 09 Aug 2024

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