Skip to content

JS lib to generate and validate CPF (Cadastro de Pessoas Físicas) of Brazil.

License

Notifications You must be signed in to change notification settings

tiagoporto/gerador-validador-cpf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

13a645e · Apr 2, 2025
Apr 2, 2025
Dec 31, 2024
Jan 24, 2025
Jan 23, 2025
Jan 12, 2025
Feb 8, 2025
Mar 26, 2025
Jan 5, 2025
Sep 30, 2021
Jan 12, 2025
Jan 23, 2025
Feb 10, 2025
Jan 21, 2025
Dec 18, 2024
Jan 12, 2025
Jan 10, 2025
Feb 8, 2025
Jan 10, 2025
Jan 6, 2025
Jan 5, 2025
Jan 10, 2025
Jan 23, 2025
Jan 23, 2025
Mar 17, 2025
Jan 13, 2025
Jan 5, 2025
Mar 26, 2025
Mar 26, 2025
Feb 10, 2025
Jan 5, 2025
Jan 5, 2025
Mar 25, 2025
Mar 25, 2025

Repository files navigation

Gerador e Validador de CPF Open Source Love

JS lib to generate and validate CPF (Cadastro de Pessoas Físicas) of Brazil.

NPM Version JSR Version

npm type definitions npm bundle size Downloads

📚 Docs

Read in other languages: English, Español e Português(Brasil)

✅ Status

Docs GA Workflow Status Checks GA Workflow Status Tests GA Workflow Status E2E Tests GA Workflow Status

Website W3C Validation

Coverage Status mutation score

🧰 Stack

node nvm pnpm vs code

git Conventional Commits Semantic Release

TypeScript React i18next Sass ejs PostCSS Autoprefixer CSS Modules PWA Browserslist

Webpack SWC Rollup Jest Cypress Chromatic Stryker

EditorConfig Prettier Eslint Stylelint Remark Husky Lint Staged Commitlint

Coveralls Dependabot GitHub Actions GitHub Pages

🎮 Playground

https://tiagoporto.github.io/gerador-validador-cpf/

📦 Installation

Install with npm:

npm install gerador-validador-cpf

Install with deno(jsr):

deno add jsr:@tiagoporto/gerador-validador-cpf

➡️ Usage

Generate CPF

import { generate as generateCpf } from 'gerador-validador-cpf'
// jsr import from "@tiagoporto/gerador-validador-cpf"

const cpf = generateCpf()
console.log(cpf) // 00000000000

const formattedCpf = generateCpf({ format: true })
console.log(formattedCpf) // 000.000.000-00

Validate CPF

import { validate as validadeCpf } from 'gerador-validador-cpf'
// jsr import from "@tiagoporto/gerador-validador-cpf"

const isCpfValid = validadeCpf('12345678900')
const isFormattedCpfValid = validadeCpf('123.456.789-00')

🛠 Development

Pre-requirements

Install node

nvm install

Install pnpm

corepack enable pnpm

Install

pnpm install

Running dev server

pnpm start

🤝 Contributing

Check how to contribute.

🤜🤛 Donating

This project is developed on my free time, any donation is welcome.

GITHUB Sponsor Paypal Donate Bitcoin

📄 License

This project is licensed under the MIT License.