feat(isLicensePlate): add support for Swedish license plates by elmaxe · Pull Request #1665 · validatorjs/validator.js
This PR adds support for Swedish license plates.
Checklist
- PR contains only changes related; no stray files, etc.
- README updated (where applicable)
- Tests written (where applicable)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Please fix the merge conflict and we should be good to go.
tux-tn
left a comment
•
Loading
tux-tn
left a comment
•
Loading
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @elmaxe and thank you for your PR. Can you please check my comments below?
In addition to that i have two more general feedbacks:
- Multiple white-spaces are considered a valid license plate. You should probably trim your string before passing it to the regex validation in order to prevent that.
- According to the wikipedia page of swedish license plates, a plate can't end with the
Ocharacter to prevent it from being confused with0, i don't see that exception in your regex, am i wrong?
README.md
Outdated
Show resolved
Hide resolved
- Multiple white-spaces are considered a valid license plate. You should probably trim your string before passing it to the regex validation in order to prevent that.
Fair!
- According to the wikipedia page of swedish license plates, a plate can't end with the
Ocharacter to prevent it from being confused with0, i don't see that exception in your regex, am i wrong?
Interestingly this is not on the Swedish wikipedia page, but it is correct (source)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉 Thank you for taking the time to address my comments
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks! 🎉
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters