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)
npm install gerador-validador-cpf --save
import { generate as generateCPF } from 'gerador-validador-cpf'
generateCPF([formatOption])
Check format options
import { validate as validateCPF } from 'gerador-validador-cpf'
validateCPF('123.456.789-00')
Note: characters like .
, -
and space
are allowed.
import { format as formatCPF } from 'gerador-validador-cpf'
formatCPF('123.456.789-00', [formatOption])
Check format options
Note: characters like .
, -
and space
are allowed.
import { format as formatCPF } from 'gerador-validador-cpf'
formatCPF('12345678901')
Generates a CPF in the format xxx.xxx.xxx-xx
import { format as formatCPF } from 'gerador-validador-cpf'
formatCPF('123.456.789-01', 'digits')
Generates a CPF in the format xxxxxxxxxxx
import { format as formatCPF } from 'gerador-validador-cpf'
formatCPF('12345678901', 'checker')
Generates CPF in the format xxxxxxxxx-xx
This project is developed in my free time, donations are welcome.
Gerador e validador de CPF is released under the terms of the MIT license.