Skip to content

✨ Add alphanumeric CNPJ support#64

Open
m7ez1n wants to merge 2 commits intoVitorLuizC:masterfrom
m7ez1n:master
Open

✨ Add alphanumeric CNPJ support#64
m7ez1n wants to merge 2 commits intoVitorLuizC:masterfrom
m7ez1n:master

Conversation

@m7ez1n
Copy link
Copy Markdown

@m7ez1n m7ez1n commented Feb 3, 2026

Summary

Implements alphanumeric CNPJ validation and formatting support as specified in Issue #63.

Changes

  • Updated isCNPJ validator to accept 12 alphanumeric characters + 2 numeric check digits
  • Updated formatToCNPJ to format alphanumeric CNPJs (AA.AAA.AAA/AAAA-DV)
  • Added case-insensitive support for lowercase alphanumeric inputs
  • Updated formatToCPFOrCNPJ to detect alphanumeric values as CNPJ
  • Replaced ES6+ methods with ES5-compatible alternatives

Test Cases

  • Numeric CNPJs: 15.216.260/0001-76
  • Alphanumeric CNPJs: 6A3EDMWP000168, D7YDDI5H000162, Q2.GRO.WP7/0001-85
  • Invalid alphanumeric CNPJs with wrong check digits

Closes #63

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.

Adicionar suporte ao CNPJ alfanumerico

1 participant