/gerador-validador-cpf

Biblioteca JS para gerar, validar e formatar CPF

Primary LanguageCSSMIT LicenseMIT

Gerador e Validador de CPF Open Source Love

LIKED ? Leave a : 😞

Release Downloads install size bundle size npm type definitions License

Build Status Coverage Status Mutation testing cover

js-standard-style devDependencies Status

JS open-source lib to generate, validate and formate CPF.

The tool can be accessed on tiagoporto.github.io/gerador-validador-cpf.

Read this in other languages: English, Português(Brasil)

Topics

Installation

npm install gerador-validador-cpf --save

Generate CPF

import { generate as generateCPF } from 'gerador-validador-cpf'

generateCPF([formatOption])

Check format options

Validate CPF

import { validate as validateCPF } from 'gerador-validador-cpf'

validateCPF('123.456.789-00')

Note: characters like ., - and space are allowed.

Formate CPF

import { format as formatCPF } from 'gerador-validador-cpf'

formatCPF('123.456.789-00', [formatOption])

Check format options

Note: characters like ., - and space are allowed.

Format options

Default
import { format as formatCPF } from 'gerador-validador-cpf'

formatCPF('12345678901')

Generates a CPF in the format xxx.xxx.xxx-xx

Digits
import { format as formatCPF } from 'gerador-validador-cpf'

formatCPF('123.456.789-01', 'digits')

Generates a CPF in the format xxxxxxxxxxx

Checker
import { format as formatCPF } from 'gerador-validador-cpf'

formatCPF('12345678901', 'checker')

Generates CPF in the format xxxxxxxxx-xx

Contribute

How to contribute.

Donation

This project is developed in my free time, donations are welcome.

Donate Donate

License

Gerador e validador de CPF is released under the terms of the MIT license.