feat(isLicensePlate): add support for Swedish license plates by elmaxe · Pull Request #1665 · validatorjs/validator.js

@elmaxe

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)

@elmaxe

@elmaxe

@codecov

profnandaa

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.

@elmaxe

@elmaxe

tux-tn

@tux-tn 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 with 0, i don't see that exception in your regex, am i wrong?

@elmaxe

  • 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 with 0, 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)

tux-tn

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

profnandaa

Choose a reason for hiding this comment

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

LGTM, thanks! 🎉