feat(isTaxID): add en-IN (PAN) support, rebase of #2032 by @ajinkyac03 - #2835
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2835 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 114 114
Lines 2598 2598
Branches 658 658
=========================================
Hits 2598 2598 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
rubiin
approved these changes
Aug 3, 2026
rubiin
requested review from
WikiRik and
tux-tn
and removed request for
WikiRik
August 3, 2026 20:28
tux-tn
approved these changes
Aug 4, 2026
tux-tn
left a comment
Member
There was a problem hiding this comment.
LGTM! Thank you for taking the time to rebase and improve the existing PR
Member
|
also other mc-to-land are for take |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Picks up #2032 by @ajinkyac03, which was approved and labelled
mc-to-landbut has been sitting on merge conflicts since March 2025. Doing this per @rubiin's instructions in #2410 (fork, keep the original author's commits, resolve the conflicts). All three commits are still authored by @ajinkyac03, I only rebased them and fixed the conflicts. All credit for the regex and tests is theirs.Adds
en-IN(Indian PAN) support toisTaxID.What the conflict actually was
Nothing to do with the code. #2032 patched
test/validators.js, which has since been renamed totest/validators.test.js, so the whole PR showed as conflicting. Once rebased,src/lib/isTaxID.jsand the test file both merged cleanly. The only manual resolution was the README row, which had drifted over the years, so I took master's current row and added'en-IN'to the locale list in alphabetical position.Net change is unchanged from what was approved: one regex, one README locale, one test block.
The regex
PAN is 10 characters,
AAAAA9999A. The 4th character is a holder-type code, and only ten letters are valid there (A, B, C, F, G, H, J, L, P, T for Association of Persons, Body of Individuals, Company, Firm, Government, HUF, Artificial Juridical Person, Local Authority, Individual, Trust). The(?!0000)guards the serial, which runs 0001-9999.Reference: https://incometaxindia.gov.in/Pages/tax-services/permanent-account-number.aspx
en-INisn't intaxIdCheck, so it takes the existing "not all locales have algorithmic checks" fallthrough. That's deliberate, since PAN's check character has no published algorithm.Verification
All 10 of the original test vectors pass, and
en-US/en-IEare unaffected. Full suite 290 passing, eslint clean.Worth flagging one vector, since it looks wrong at a glance:
ABCDE1234Fis in the invalid list even though it's the example string on the income tax site. It's correctly rejected, becauseDisn't a valid 4th-character holder code. That string is a format illustration rather than a real PAN.Note on #2703
There's an open #2703 adding a separate
isPANvalidator for the same data. Not my call which approach you prefer, but for what it's worth this one is the already-approved route, and #2703's[A-Z]{5}[0-9]{4}[A-Z]acceptsABCDE1234Fand other invalid holder-type codes.Happy to rebase again if #2698 lands first and moves the tests.
Closes #2032
Checklist