validator.js icon indicating copy to clipboard operation
validator.js copied to clipboard

feat(isCPF): add validation to Brazilian CPF

Open KelvinDiasMoreira opened this issue 8 months ago • 0 comments

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

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

KelvinDiasMoreira avatar Apr 02 '25 03:04 KelvinDiasMoreira