Skip to content

feat: add support for alphanumeric CNPJ#34

Draft
gabeins wants to merge 2 commits intomainfrom
claude/update-cnpj-validation-011CUTau9YoMgZ74jvZarz1A
Draft

feat: add support for alphanumeric CNPJ#34
gabeins wants to merge 2 commits intomainfrom
claude/update-cnpj-validation-011CUTau9YoMgZ74jvZarz1A

Conversation

@gabeins
Copy link
Copy Markdown
Owner

@gabeins gabeins commented Oct 26, 2025

Implements support for the new alphanumeric CNPJ format being introduced in July 2026 by Brazil's Federal Revenue Service, while maintaining full backward compatibility with numeric CNPJs.

Changes:

  • Add alphanumeric validation with modulo 11 check digit algorithm
  • Add strict mode option to validate() for uppercase enforcement
  • Update format() to handle both numeric and alphanumeric CNPJs
  • Update generate() with optional format parameter (numeric/alphanumeric)
  • Add comprehensive test coverage (24 tests, all passing)
  • Update documentation with examples and API details

The validate() function now accepts an optional second parameter:
{ strict: boolean } - rejects lowercase letters when true

The generate() function now accepts an optional parameter:
{ format: 'numeric' | 'alphanumeric' } - defaults to 'numeric'

All existing code continues to work without modifications.

Closes #33.

Implements support for the new alphanumeric CNPJ format being introduced
in July 2026 by Brazil's Federal Revenue Service, while maintaining full
backward compatibility with numeric CNPJs.

Changes:
- Add alphanumeric validation with modulo 11 check digit algorithm
- Add strict mode option to validate() for uppercase enforcement
- Update format() to handle both numeric and alphanumeric CNPJs
- Update generate() with optional format parameter (numeric/alphanumeric)
- Add comprehensive test coverage (24 tests, all passing)
- Update documentation with examples and API details
- Bump version to 5.1.0 (minor - backward compatible)

The validate() function now accepts an optional second parameter:
  { strict: boolean } - rejects lowercase letters when true

The generate() function now accepts an optional parameter:
  { format: 'numeric' | 'alphanumeric' } - defaults to 'numeric'

All existing code continues to work without modifications.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@gabeins gabeins self-assigned this Oct 26, 2025
Version bumps are handled during release tagging after merge to main.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
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.

CNPJ Alfanumérico

2 participants