Added support for PK(Pakistan) in isIdentityCard by Daniyal-Qureshi · Pull Request #2291 · validatorjs/validator.js

@Daniyal-Qureshi

Add a regex pattern for validating valid Pakistani Computerized National Identity Cards (CNICs):

Checklist

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

@Daniyal-Qureshi

@codecov

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.95%. Comparing base (b958bd7) to head (e46885f).
Report is 33 commits behind head on master.

Current head e46885f differs from pull request most recent head 622e39c

Please upload reports for the commit 622e39c to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2291      +/-   ##
==========================================
- Coverage   99.95%   99.95%   -0.01%     
==========================================
  Files         107      107              
  Lines        2454     2453       -1     
  Branches      619      619              
==========================================
- Hits         2453     2452       -1     
  Partials        1        1              

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

@Daniyal-Qureshi

WikiRik

Choose a reason for hiding this comment

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

Please use 'PK' as locale instead of 'ur-PK'
What's the source for the regex?

@Daniyal-Qureshi

@WikiRik
I've adopted a convention familiar to many developers, using the initial of the national language followed by the initial of the country name. Please Check out the source behind this intriguing regex pattern: CNIC regex format

@Daniyal-Qureshi

@WikiRik Hi is there any other fixes needed here.

@rubiin

@Daniyal-Qureshi

rubiin

@rubiin rubiin left a comment

Loading

Choose a reason for hiding this comment

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

ur-PK you could simply do as PK as suggested by @WikiRik
rest looks good for merge imo

@Daniyal-Qureshi

@Daniyal-Qureshi

@rubiin I have changed the local from ur-PK to PK, please review.

rubiin

@Daniyal-Qureshi Daniyal-Qureshi changed the title Added support for ur-PK(Pakistan) in isIdentityCard Added support for PK(Pakistan) in isIdentityCard

Jun 2, 2024

profnandaa

Choose a reason for hiding this comment

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

LGTM, thanks for your contrib! 🎉