theuves / Cpf
Licence: mit
Validar, formatar e gerar números de CPF (validate, format and generate CPF numbers 🇧🇷).
Stars: ✭ 51
Programming Languages
javascript
184084 projects - #8 most used programming language
Labels
Projects that are alternatives of or similar to Cpf
cnpj
🇧🇷 Format, validate and generate CNPJ numbers in Node & Deno
Stars: ✭ 26 (-49.02%)
Mutual labels: validation, brazil
Celebrate
A joi validation middleware for Express.
Stars: ✭ 1,041 (+1941.18%)
Mutual labels: validation
Mobx React Form
Reactive MobX Form State Management
Stars: ✭ 1,031 (+1921.57%)
Mutual labels: validation
Partial.lenses.validation
Partial Lenses Validation is a JavaScript library for validating and transforming data
Stars: ✭ 39 (-23.53%)
Mutual labels: validation
Schemas
All schemas used for validation that are shared between our projects
Stars: ✭ 51 (+0%)
Mutual labels: validation
Covid19 Brazil Timeseries
Data collection to analyze the dissemination of COVID-19 through Brazilian states. Contributions are welcome.
Stars: ✭ 43 (-15.69%)
Mutual labels: brazil
Pycard
A simple credit card validation Python library with no dependencies
Stars: ✭ 40 (-21.57%)
Mutual labels: validation
Formik Alicante
Formik slides & demos from React Alicante
Stars: ✭ 47 (-7.84%)
Mutual labels: validation
Laravel Smart
Automatic Migrations, Validation and More
Stars: ✭ 48 (-5.88%)
Mutual labels: validation
Validator
Client-side javascript validator library ports from Laravel 5.2
Stars: ✭ 35 (-31.37%)
Mutual labels: validation
Brazilcustomerattributes
Magento 2 module to adapt customer and address fields to brazil.
Stars: ✭ 46 (-9.8%)
Mutual labels: brazil
Arg.js
🇦🇷 🛠 NPM library. Validation of Argentinian bank account numbers, IDs and phone numbers
Stars: ✭ 52 (+1.96%)
Mutual labels: validation
Vs Validation
Common input and integrity validation routines for Visual Studio and other applications
Stars: ✭ 48 (-5.88%)
Mutual labels: validation
cpf
Functions to handle Brazilian CPF numbers
Installation
You can install it with npm or yarn.
Try:
-
npm:
npm install cpf
-
yarn:
yarn add cpf
Usage
const CPF = require('cpf');
Now, CPF
is a object with some functions:
format
generate
isValid
CPF.format(cpf)
Format a CPF number.
Example
CPF.format('11144477735');
//=> '111.444.777-35'
Parameters
-
cpf
{string} A CPF number.
Returns a string with the formatted CPF number.
CPF.generate(formatted, invalid)
Generate a random CPF number.
Parameters
-
formatted
{boolean}true
by default. It will generate a formatted CPF number. -
invalid
{boolean}false
by default. It will generate a invalid CPF number.
Returns a CPF number.
CPF.isValid(cpf, byLength)
Check if a CPF number is valid.
Example
CPF.isValid('111.444.777-35');
// true
CPF.isValid('111.444.777-42');
// false
CPF.isValid('111.444.777-42', true);
// true
CPF.isValid('111.444.777', true);
// false
Parameters
-
cpf
{string} Check if the CPF number is valid. -
byLength
{boolean}false
by default. Check only if the length is valid.
Returns the check result.
License
MIT © Matheus Alves
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].