Uh oh!
There was an error while loading. Please reload this page.
Add Czech license plates - #1565
Conversation
Codecov Report
@@ Coverage Diff @@## master #1565 +/- ##
=========================================
Coverage 100.00% 100.00% =========================================
Files 101 101 Lines 1854 1855 +1 =========================================
+ Hits 1854 1855 +1
Continue to review full report at Codecov.
|
profnandaa
left a comment
There was a problem hiding this comment.
Looks good, however, could add a few test cases?
filiptronicek
commented
Feb 15, 2021
@profnandaa yes, totally agreed, but as I mentioned, I am not really comfortable in writing tests here yet, any guide to get me started? |
MoltenCoffee
commented
May 11, 2021
This should get you started: test({validator: 'isLicensePlate',args: ['cs-CZ'],valid: ['valid-plate1','valid-plate2'],invalid: ['','invalidlicenseplate','A1-B2-C3','ABC-1-EF',],});Edit and add to |
| const validators = { | ||
| 'cs-CZ': str => | ||
| /^(([ABCDEFHKIJKLMNPRSTUVXYZ]|[0-9])-?){5,8}$/.test(str), |
There was a problem hiding this comment.
| /^(([ABCDEFHKIJKLMNPRSTUVXYZ]|[0-9])-?){5,8}$/.test(str), | |
| /^[0-9]([A-Z][0-9]{5}|[A-Z]{2}[0-9]{4})$/.test(str), |
nit: we can increase accuracy in this way.
Passing examples:
0A189290AB1892This regex does not take into account custom license plates and we have to check it separately.
There was a problem hiding this comment.
This shortened version looks way better, I agree @fedeci, but this does not include disallowed characters, which include O, G, Q, and W.
There was a problem hiding this comment.
According to what I understood from wikipedia, those characters are only disallowed in custom license plates🤔
There was a problem hiding this comment.
I think maybe there is conflicting information on the article in English, and the one which is in Czech, this is a paragraph translated from the Czech one:
Today's marks contain five to seven characters, depending on the vehicle type (numbers and letters without accents, except for G, O, Q, W, which could be confused with C, V, and the number 0 or the number 6).
This means, that this applies to all license plates, not just custom ones.
rubiin
commented
Jul 5, 2021
@profnandaa looks stale , lets get it merged if author is still available or I could add in few tests with the new PR |
rubiin
commented
Jul 5, 2021
Yes please add more tests as said by @profnandaa so we could merge it. This is to limit stale PRs |
filiptronicek
commented
Jul 6, 2021
@rubiin added those tests! |
profnandaa
left a comment
There was a problem hiding this comment.
Thanks for your contribution! 🎉
I have added Czech license plates with regards to all the possible cases I found. RegExr with tests
Checklist