Skip to content

feat(isCPF): add validation to Brazilian CPF #2543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

KelvinDiasMoreira
Copy link

@KelvinDiasMoreira KelvinDiasMoreira commented Apr 2, 2025

Description

Added a function to validate CPF numbers in src/lib/isCPF.js, ensuring they comply with the official validation algorithm. The function checks if the CPF has 11 numeric digits and if the verification digits are correctly calculated.

References

The validation follows the rules defined by the Brazilian Federal Revenue Service for CPF verification digit calculation.

Files Changed

  • src/lib/isCPF.js – Added the CPF validation function
  • test/validators.test.js – Added unit tests

Checklist

  • PR contains only changes related; no stray files, etc.
  • README updated (where applicable)
  • Tests written (where applicable)
  • References provided in PR (where applicable)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants