Skip to content

feat: add postal code validation for TR, PH, MA, and VN#2740

Open
realkeshav08 wants to merge 1 commit into
validatorjs:masterfrom
realkeshav08:feature/add-new-postal-code-locales
Open

feat: add postal code validation for TR, PH, MA, and VN#2740
realkeshav08 wants to merge 1 commit into
validatorjs:masterfrom
realkeshav08:feature/add-new-postal-code-locales

Conversation

@realkeshav08
Copy link
Copy Markdown

Description

This PR adds support for validating postal codes from four additional countries inside the isPostalCode validator:

  1. Turkey (TR): 5 digits (e.g. 34000)
  2. Philippines (PH): 4 digits (e.g. 1000)
  3. Morocco (MA): 5 digits (e.g. 20000)
  4. Vietnam (VN): 5 digits (e.g. 10000)

Changes Made

  • Added regex patterns for TR, PH, MA, and VN to the patterns list in src/lib/isPostalCode.js.
  • Added corresponding unit test fixtures (both valid and invalid test cases) in test/validators.test.js.

Verification

Ran tests locally using npm test and verified that:

  • All 318 test suites pass successfully.
  • 100% statement and line coverage is maintained across all modified sections.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (7fdc788) to head (05a3c18).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2740   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          114       114           
  Lines         2587      2587           
  Branches       656       656           
=========================================
  Hits          2587      2587           

☔ View full report in Codecov by Harness.
📢 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.

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.

1 participant