Skip to content

Commit f54599c

Browse files
authored
refactor: make brazilian postal code separator optional (#2493)
1 parent def7f3e commit f54599c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/lib/isPostalCode.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const patterns = {
1414
BA: /^([7-8]\d{4}$)/,
1515
BE: fourDigit,
1616
BG: fourDigit,
17-
BR: /^\d{5}-\d{3}$/,
17+
BR: /^\d{5}-?\d{3}$/,
1818
BY: /^2[1-4]\d{4}$/,
1919
CA: /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][\s\-]?\d[ABCEGHJ-NPRSTV-Z]\d$/i,
2020
CH: fourDigit,

test/validators.test.js

+3
Original file line numberDiff line numberDiff line change
@@ -12742,6 +12742,9 @@ describe('Validators', () => {
1274212742
'39100-000',
1274312743
'22040-020',
1274412744
'39400-152',
12745+
'39100000',
12746+
'22040020',
12747+
'39400152',
1274512748
],
1274612749
invalid: [
1274712750
'79800A12',

0 commit comments

Comments
 (0)