Skip to content

feat(isLicensePlate): Updated isLicensePlate to accept real pt-PT license plates. #2555

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/isLicensePlate.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 27 additions & 1 deletion test/validators.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14283,16 +14283,42 @@ describe('Validators', () => {
args: ['pt-PT'],
valid: [
'AA-12-34',
'12·34·AB',
'12-AA-34',
'12-34-AA',
'AA-12-AA',
'AA·12·34',
'12·AB·34',
'12·34·AB',
'AB·34·AB',
'AA 12 34',
'12 AA 34',
'12 34 AA',
'AB 12 CD',
'AA1234',
'12AA34',
'1234AA',
'AB12CD',
],
invalid: [
Copy link
Member

Choose a reason for hiding this comment

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

Can you add some more invalids here? I can imagine that we will try to simplify the regular expression in the future and we want to make sure we do not accidentally validate license plates like; 00-AA-AA, AA-AA-AA, 00-00-00 etc

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, all invalids done for now

'',
'notalicenseplate',
'AA-AA-00',
'00-AA-AA',
'AA-AA-AA',
'00-00-00',
'AA·AA·00',
'00·AA·AA',
'AA·AA·AA',
'00·00·00',
'AA AA 00',
'00 AA AA',
'AA AA AA',
'00 00 00',
'A1-B2-C3',
'1A-2B-3C',
'ABC-1-EF',
'AB-C1D-EF',
'AB-C1-DEF',
],
});
test({
Expand Down