Skip to content

Commit

Permalink
refactor: make brazilian postal code separator optional (#2493)
Browse files Browse the repository at this point in the history
ticmaisdev authored Nov 13, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent def7f3e commit f54599c
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/isPostalCode.js
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ const patterns = {
BA: /^([7-8]\d{4}$)/,
BE: fourDigit,
BG: fourDigit,
BR: /^\d{5}-\d{3}$/,
BR: /^\d{5}-?\d{3}$/,
BY: /^2[1-4]\d{4}$/,
CA: /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][\s\-]?\d[ABCEGHJ-NPRSTV-Z]\d$/i,
CH: fourDigit,
3 changes: 3 additions & 0 deletions test/validators.test.js
Original file line number Diff line number Diff line change
@@ -12742,6 +12742,9 @@ describe('Validators', () => {
'39100-000',
'22040-020',
'39400-152',
'39100000',
'22040020',
'39400152',
],
invalid: [
'79800A12',

0 comments on commit f54599c

Please sign in to comment.