Skip to content

Commit

Permalink
feat(isPostalCode): support for IR locale (#1515)
Browse files Browse the repository at this point in the history
Co-authored-by: Masoud <msdDaliriyan@gmai.com>
  • Loading branch information
masoudDaliriyan and Masoud authored Nov 29, 2020
1 parent f4d7fe7 commit 527950a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/isPostalCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const patterns = {
IE: /^(?!.*(?:o))[A-z]\d[\dw]\s\w{4}$/i,
IL: /^(\d{5}|\d{7})$/,
IN: /^((?!10|29|35|54|55|65|66|86|87|88|89)[1-9][0-9]{5})$/,
IR: /\b(?!(\d)\1{3})[13-9]{4}[1346-9][013-9]{5}\b/,
IS: threeDigit,
IT: fiveDigit,
JP: /^\d{3}\-\d{4}$/,
Expand Down
12 changes: 12 additions & 0 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -9083,6 +9083,18 @@ describe('Validators', () => {
'1000',
],
},
{
locale: 'IR',
valid: [
'4351666456',
'5614736867',
],
invalid: [
'43516 6456',
'123443516 6456',
'891123',
],
},
{
locale: 'CZ',
valid: [
Expand Down

0 comments on commit 527950a

Please sign in to comment.