Skip to content

Commit

Permalink
refactor: make brazilian postal code separator optional (validatorjs#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ticmaisdev authored Nov 13, 2024
1 parent def7f3e commit f54599c
Show file tree
Hide file tree
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
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions test/validators.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12742,6 +12742,9 @@ describe('Validators', () => {
'39100-000',
'22040-020',
'39400-152',
'39100000',
'22040020',
'39400152',
],
invalid: [
'79800A12',
Expand Down

0 comments on commit f54599c

Please sign in to comment.