Skip to content

feat(isAlpha, isAlphanumeric): add support for Indic locales (ta-IN, te-IN, kn-IN, ml-IN, gu-IN, pa-IN, or-IN) #2576

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

Merged
merged 6 commits into from
Aug 5, 2025

Conversation

avadootharajesh
Copy link
Contributor

This commit introduces Indic language support into isAlpha and isAlphanumeric methods.

Languages added:

Test Result

Screenshot 2025-07-20 132235

Checklist

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

Copy link

codecov bot commented Jul 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (72573b3) to head (460ecf3).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2576   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          114       114           
  Lines         2535      2535           
  Branches       641       641           
=========================================
  Hits          2535      2535           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@avadootharajesh
Copy link
Contributor Author

Hey reviewer!

  • Added support for Indian languages 🎉
  • Added basic support for Indian languages in the validator.
  • Tested a few cases, things look good. Open to feedback!

let me know If I have to do anything else...

@rubiin rubiin requested a review from Copilot July 20, 2025 08:55
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for seven Indic languages (Tamil, Telugu, Kannada, Malayalam, Gujarati, Punjabi, and Odia) to the isAlpha and isAlphanumeric validator functions. The implementation includes Unicode character ranges for each language, appropriate decimal handling, and comprehensive test coverage.

  • Adds Unicode regex patterns for seven Indic locales covering their respective character ranges
  • Updates decimal and comma decimal configurations for the new locales
  • Provides comprehensive test coverage with valid and invalid test cases for each language

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/lib/alpha.js Adds Unicode regex patterns for Indic languages and updates decimal configurations
test/validators.test.js Adds comprehensive test cases for all seven new Indic language validators
README.md Updates documentation to include the new supported locales in isAlpha and isAlphanumeric descriptions
Comments suppressed due to low confidence (1)

test/validators.test.js:1988

  • The Bengali (bn-IN) locale is being tested but was not mentioned in the PR title or description as one of the new Indic locales being added. This test appears to be for an existing locale rather than a newly added one.
  it('should validate Bengali alpha strings', () => {

@avadootharajesh
Copy link
Contributor Author

avadootharajesh commented Jul 21, 2025

Are there any other issues?
Cuz bengali test was added by someone else, hence I have mentioned what I have done
As it ( bengali ) is existing, I did not take a step to change it Or fakely add it to my pr
@Copilot @rubiin

@avadootharajesh
Copy link
Contributor Author

@chriso @rubiin @profnandaa Am I needed to do any other changes or the code is perfect to be merged ?

avadootharajesh and others added 2 commits August 3, 2025 21:20
Removed unwanted npm-debug.log
( Generated at my end )
@avadootharajesh
Copy link
Contributor Author

avadootharajesh commented Aug 3, 2025

Changes included:

  1. Sorted locales in the alpha.js file and the README file in lexicographical order.
  2. Added isAlphanumeric test cases for the newly added Indic locales.
  3. Removed redundant locale specifications from the decimal validator since they are already covered under commaDecimal.
    ( Made the requested changes. Please check. @WikiRik @rubiin )

Test Results

Test Results Screenshot


Checklist

  • Only relevant files changed, no stray files.
  • README/documentation updated accordingly.
  • Tests added and passing for new Indic locales.
  • Unicode reference links provided for all added locales.

Thank you for reviewing! @WikiRik
Feel free to ask for any clarifications.

@avadootharajesh avadootharajesh requested a review from WikiRik August 3, 2025 16:11
@avadootharajesh
Copy link
Contributor Author

Changes included:

  1. Reverted requested changes to locale sorting.
  2. Added decimal support for Bengali locale in the validator.
  3. Ensured all tests pass with updated decimal handling.

Test Results

Test Results Screenshot


Checklist

  • Only relevant files changed, no stray files.
  • README/documentation updated accordingly.
  • Tests added and passing for new Indic locales.
  • Unicode reference links provided for all added locales.

Thank you for reviewing! @WikiRik
Feel free to ask for any clarifications.

@avadootharajesh avadootharajesh requested a review from WikiRik August 4, 2025 12:03
@avadootharajesh
Copy link
Contributor Author

avadootharajesh commented Aug 4, 2025

Changes included:

  1. Removed extra line in alpha.js and added required lines in validator.test.js.
  2. Removed bn-IN locales as they are already been added and handled according cases.
  3. Removed unnecessary comment.

Test Results

Test Results Screenshot


Checklist

  • Only relevant files changed, no stray files.
  • README/documentation updated accordingly.
  • Tests added and passing for new Indic locales.

Thank you for reviewing! @WikiRik
Feel free to ask for any clarifications.

@avadootharajesh avadootharajesh requested a review from WikiRik August 4, 2025 20:57
Copy link
Member

@WikiRik WikiRik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this and incorporating all of my comments!

@WikiRik WikiRik requested a review from rubiin August 5, 2025 07:47
@rubiin rubiin merged commit abcc8ec into validatorjs:master Aug 5, 2025
13 checks passed
@avadootharajesh
Copy link
Contributor Author

Hey, Thanks for merging, feeling happy for my contribution.
Just to remind, you've forgot to add me as a contributor.
Please do, I would love t be a part of the project @WikiRik @rubiin

@WikiRik
Copy link
Member

WikiRik commented Aug 6, 2025

Hey, Thanks for merging, feeling happy for my contribution. Just to remind, you've forgot to add me as a contributor. Please do, I would love t be a part of the project @WikiRik @rubiin

You'll be mentioned in the release notes of the next release (which I will draft after #2574 is merged) . GitHub mentions you as 'Contibutor' in new PRs and comments, but that is not something we control. GitHub does that last bit automatically

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.

3 participants