Skip to content
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

Fixed pt-PT alpha and alphanumeric validation #1207

Merged
merged 2 commits into from Dec 6, 2019
Merged

Fixed pt-PT alpha and alphanumeric validation #1207

merged 2 commits into from Dec 6, 2019

Conversation

ghost
Copy link

@ghost ghost commented Nov 27, 2019

In 2009 a new spelling reform abolished the diaeresis diacritical mark from the portuguese language. The agreement, however, decreed that proper names should keep it.

I have made changes to the alpha and alphanumeric validation to accepts every vowel with a diaresis mark. It's a very common use case of my projects have an input field that should holds a user name. That field should only have alpha characters and I would expect that "Schäfer" (my surname) would pass this validation.

The current validator.js version accepts the 'ü' as an alpha character, but not any other vowel with ¨. In order to be consistent it should allow every vowel or none.

✌️

@ghost
Copy link
Author

ghost commented Nov 28, 2019

@profnandaa

@@ -13,7 +13,7 @@ export const alpha = {
'nn-NO': /^[A-ZÆØÅ]+$/i,
'hu-HU': /^[A-ZÁÉÍÓÖŐÚÜŰ]+$/i,
'pl-PL': /^[A-ZĄĆĘŚŁŃÓŻŹ]+$/i,
'pt-PT': /^[A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]+$/i,
'pt-PT': /^[A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will look deeper into the research above. But for now, we can add or edit tests for the addition/changes made on this part.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All right. Since there aren't any tests regarding this locale, I'll write it.

@@ -43,7 +43,7 @@ export const alphanumeric = {
'nl-NL': /^[0-9A-ZÁÉËÏÓÖÜÚ]+$/i,
'nn-NO': /^[0-9A-ZÆØÅ]+$/i,
'pl-PL': /^[0-9A-ZĄĆĘŚŁŃÓŻŹ]+$/i,
'pt-PT': /^[0-9A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]+$/i,
'pt-PT': /^[0-9A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apply the comment above on this part.

Copy link
Member

@profnandaa profnandaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for your contrib. This being your first landing, welcome to the team! 🎉

@profnandaa profnandaa merged commit a1552d8 into validatorjs:master Dec 6, 2019
@ghost ghost deleted the bugfix/is_alpha_pt-br branch December 6, 2019 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants