Gathering detailed insights and metrics for validations-br
Gathering detailed insights and metrics for validations-br
Gathering detailed insights and metrics for validations-br
Gathering detailed insights and metrics for validations-br
npm install validations-br
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
139 Stars
78 Commits
20 Forks
7 Watching
3 Branches
10 Contributors
Updated on 11 Nov 2024
Minified
Minified + Gzipped
TypeScript (99.24%)
JavaScript (0.61%)
Shell (0.15%)
Cumulative downloads
Total Downloads
Last day
328.1%
929
Compared to previous day
Last week
62.7%
6,893
Compared to previous week
Last month
12.8%
29,552
Compared to previous month
Last year
4.7%
327,074
Compared to previous year
Leia isso em outras línguas: English
Validations BR é um cinto de ferramentas de funções para validar documentos padrões no Brasil e mais.
Com npm:
1npm install validations-br
Com yarn:
1yarn add validations-br
Chave | Tipo | Descrição |
---|---|---|
type | cnpj | cpf | cep | email | pis | phone | uf | Tipo de dados que serão validados |
value | string | Valor que será validado |
1import { useValidationsBR } from 'validations-br'; 2// const { useValidationsBR } = require('validations-br'); 3 4const cnpj = '09.015.844/0001-80'; 5const isValid = useValidationsBR('cnpj', cnpj);
1import { validateCNPJ } from 'validations-br'; 2// const { validateCNPJ } = require('validations-br'); 3 4 5const cnpj = '09.015.844/0001-80'; 6const isValid = validateCNPJ(cnpj);
1import { validateCPF } from 'validations-br'; 2// const { validateCPF } = require('validations-br'); 3 4const cpf = '370.785.180-04'; 5const isValid = validateCPF(cpf);
1import { validateIE } from 'validations-br'; 2// const { validateIE } = require('validations-br'); 3 4const ie = '535.371.880.779'; 5const isValid = validateIE(ie, 'sp');
1import { validatePIS } from 'validations-br'; 2// const { validatePIS } = require('validations-br'); 3 4const pis = '833.28281.34-7'; 5const isValid = validatePIS(pis);
1import { validateCNH } from 'validations-br'; 2// const { validateCNH } = require('validations-br'); 3 4const cnh = '134621966-24'; 5const isValid = validateCNH(cnh);
1import { validatePhone } from 'validations-br'; 2// const { validatePhone } = require('validations-br'); 3 4const phone = '(14) 99767-9472'; 5const isValid = validatePhone(phone);
1import { validateCEP } from 'validations-br'; 2// const { validateCEP } = require('validations-br'); 3 4const cep = '17280-000'; 5const isValid = validateCEP(cep);
1import { validateUF } from 'validations-br'; 2// const { validateUF } = require('validations-br'); 3 4const uf = 'SP'; 5const isValid = validateUF(uf);
1import { validateEmail } from 'validations-br'; 2// const { validateEmail } = require('validations-br'); 3 4const email = 'johndoe@gmail.com'; 5const isValid = validateEmail(email);
1import { validateCNPJ } from "validations-br"; 2import * as Yup from "yup"; 3 4try { 5 const schema = Yup.string().test( 6 "is-cnpj", 7 "CNPJ is not valid", 8 (value) => validateCNPJ(value) 9 ); 10 11 await schema.validate(cnpj); 12} catch(err) { 13 console.log(err.message); 14}
1import { validateCNPJ } from "validations-br"; 2import Joi from "joi"; 3 4try { 5 const schema = Joi.string().custom(validateCNPJ, "Validate CNPJ"); 6 7 const { value } = schema.validate(cnpj); 8 9 if (!value) { 10 throw Error("CNPJ is not valid"); 11 } 12} catch(err) { 13 console.log(err.message); 14}
Fique a vontade para contribuir com o projeto. Nós só pedimos para que:
$ yarn test
or $ npm run test
)MIT © Reactivando
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 6/15 approved changesets -- score normalized to 4
Reason
7 existing vulnerabilities detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More