-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean PR 1014 relating to fixing BR postal Code #1082
Conversation
aa26332
to
8f87034
Compare
src/lib/isPostalCode.js
Outdated
@@ -12,7 +12,7 @@ const patterns = { | |||
AU: fourDigit, | |||
BE: fourDigit, | |||
BG: fourDigit, | |||
BR: /^\d{5}-\d{3}$/, | |||
BR: /^\d{5}(-\d{3})$/, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bloodf added a regex where it made sure that it will allow -, . , |
as a separator.
From my own research, I realized there are no cases where the separator was not -
.
That is why I removed some of his changes.
Cc. @profnandaa.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the use of the brackets (, )
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To catch the
-\d{3}
as a group.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But, I don't know what it means by ,
you have made in the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was wondering why we need to catch the group, I'm I missing something? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is true @profnandaa, I have updated it.
@@ -6719,6 +6719,14 @@ describe('Validators', () => { | |||
'22040-020', | |||
'39400-152', | |||
], | |||
invalid: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also made sure that I added tests for invalid cases. Just for safety.
Cc. @profnandaa.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
- fix issues relating to BR postal code - add more tests - closes validatorjs#1014
8f87034
to
6333c94
Compare
@profnandaa, it seems that I have reverted the changes made by @bloodf. |
Good catch @ezrqnkemboi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adds invalid test cases 👍
Yea, sure @profnandaa. |
Cleans issues arose from PR #1014.