Skip to content

Commit

Permalink
fix(isPostalCode): add better validation for EirCode IE (#1234)
Browse files Browse the repository at this point in the history
  • Loading branch information
NielsvanDijk authored and profnandaa committed Jan 18, 2020
1 parent eb787ef commit 33b4446
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions es/lib/isPostalCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var patterns = {
HR: /^([1-5]\d{4}$)/,
HU: fourDigit,
ID: fiveDigit,
IE: /^[A-z]\d[\d|w]\s\w{4}$/i,
IE: /^(?!.*(?:o))[A-z]\d[\dw]\s\w{4}$/i,
IL: fiveDigit,
IN: /^((?!10|29|35|54|55|65|66|86|87|88|89)[1-9][0-9]{5})$/,
IS: threeDigit,
Expand Down Expand Up @@ -81,4 +81,4 @@ export default function (str, locale) {
}

throw new Error("Invalid locale '".concat(locale, "'"));
}
}
4 changes: 2 additions & 2 deletions lib/isPostalCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var patterns = {
HR: /^([1-5]\d{4}$)/,
HU: fourDigit,
ID: fiveDigit,
IE: /^[A-z]\d[\d|w]\s\w{4}$/i,
IE: /^(?!.*(?:o))[A-z]\d[\dw]\s\w{4}$/i,
IL: fiveDigit,
IN: /^((?!10|29|35|54|55|65|66|86|87|88|89)[1-9][0-9]{5})$/,
IS: threeDigit,
Expand Down Expand Up @@ -94,4 +94,4 @@ function _default(str, locale) {
}

throw new Error("Invalid locale '".concat(locale, "'"));
}
}
2 changes: 1 addition & 1 deletion src/lib/isPostalCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const patterns = {
HR: /^([1-5]\d{4}$)/,
HU: fourDigit,
ID: fiveDigit,
IE: /^[A-z]\d[\d|w]\s\w{4}$/i,
IE: /^(?!.*(?:o))[A-z]\d[\dw]\s\w{4}$/i,
IL: fiveDigit,
IN: /^((?!10|29|35|54|55|65|66|86|87|88|89)[1-9][0-9]{5})$/,
IS: threeDigit,
Expand Down
1 change: 1 addition & 0 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -6937,6 +6937,7 @@ describe('Validators', () => {
'AW5 TF12',
'756 90HG',
'A65T F12',
'O62 O1O2',
],
},
{
Expand Down

0 comments on commit 33b4446

Please sign in to comment.