Skip to content

Commit 0b1befa

Browse files
committed
feat(isPostalCode): add validation for Bangladeshi (BD) postal codes
1 parent a7d5cff commit 0b1befa

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/lib/isPostalCode.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const patterns = {
1212
AU: fourDigit,
1313
AZ: /^AZ\d{4}$/,
1414
BA: /^([7-8]\d{4}$)/,
15+
BD: /^(?:[1-8]\d{3}|9[0-3]\d{2}|94[0-8]\d|949[0-9])$/,
1516
BE: fourDigit,
1617
BG: fourDigit,
1718
BR: /^\d{5}-?\d{3}$/,

test/validators.test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12982,6 +12982,22 @@ describe('Validators', () => {
1298212982
'11000',
1298312983
],
1298412984
},
12985+
{
12986+
locale: 'BD',
12987+
valid: [
12988+
'1219',
12989+
'1231',
12990+
'2201',
12991+
'1532',
12992+
'1744',
12993+
],
12994+
invalid: [
12995+
'9500',
12996+
'9999',
12997+
'9832',
12998+
'9782',
12999+
],
13000+
},
1298513001
];
1298613002

1298713003
let allValid = [];

0 commit comments

Comments
 (0)