Skip to content

Commit 527950a

Browse files
masoudDaliriyanMasoud
and
Masoud
authored
feat(isPostalCode): support for IR locale (#1515)
Co-authored-by: Masoud <[email protected]>
1 parent f4d7fe7 commit 527950a

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/lib/isPostalCode.js

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const patterns = {
3535
IE: /^(?!.*(?:o))[A-z]\d[\dw]\s\w{4}$/i,
3636
IL: /^(\d{5}|\d{7})$/,
3737
IN: /^((?!10|29|35|54|55|65|66|86|87|88|89)[1-9][0-9]{5})$/,
38+
IR: /\b(?!(\d)\1{3})[13-9]{4}[1346-9][013-9]{5}\b/,
3839
IS: threeDigit,
3940
IT: fiveDigit,
4041
JP: /^\d{3}\-\d{4}$/,

test/validators.js

+12
Original file line numberDiff line numberDiff line change
@@ -9083,6 +9083,18 @@ describe('Validators', () => {
90839083
'1000',
90849084
],
90859085
},
9086+
{
9087+
locale: 'IR',
9088+
valid: [
9089+
'4351666456',
9090+
'5614736867',
9091+
],
9092+
invalid: [
9093+
'43516 6456',
9094+
'123443516 6456',
9095+
'891123',
9096+
],
9097+
},
90869098
{
90879099
locale: 'CZ',
90889100
valid: [

0 commit comments

Comments
 (0)