Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
d1a9b6d
fix(isISO8601): disallow prepended and appended strings to RFC 3339 d…
Apr 21, 2021
907bb07
feat: added support for indonesian passport number (#1656)
rubiin May 24, 2021
2595554
feat: Export list of country codes that implement IBAN (#1669)
drorheller Jul 16, 2021
b82d4e1
feat:(isMobilePhone): add mobile number prefix 162 and 165 to zh-CN l…
laulujan Jul 16, 2021
c87956a
feat(isLicensePlate): Add Czech license plates (#1565)
filiptronicek Jul 16, 2021
044159d
feat(isBoolean) Add loose option to isBoolean validator (#1676)
Jul 16, 2021
01eeaef
feat(isMobilePhone): change the german prefix from '+490' to '+49' or…
AnnaMariaJansen Jul 16, 2021
cff8a2e
fix: npm installation error (#1697)
rubiin Jul 16, 2021
e08e79a
fix(sMobilePhone): regexp for Vietnamese phone number (#1689)
luisrivas Jul 16, 2021
d36f79c
chore: Increase coverage and make codecov more precise (#1658)
tux-tn Jul 16, 2021
f5f4fcd
feat(isIdentityCard): add TH (Thai) (#1657)
tithanayut Jul 16, 2021
8c4b3b3
chore: update pull_request_template.md (#1699)
fedeci Jul 19, 2021
5b04cc5
perf(isISO31661Alpha2): use a Set along with .has instead of includes…
jmpaya Sep 20, 2021
7376945
fix(isMagnetURI): update validation regex (#1730)
tux-tn Sep 21, 2021
f34112d
feat(isISO4217): add currency code validator (#1706)
jmpaya Sep 26, 2021
5b649c6
perf(isISO31661Alpha3): use a Set along with .has instead of includes…
jmpaya Sep 26, 2021
b0d49bd
fix(isDate): fix isdate format validation (#1711)
flymans Sep 26, 2021
69881b6
feat(isPassportNumber): fix regex for CN (#1714)
anirudhgiri Sep 26, 2021
e84623b
feat(isCreditCard): Fixed regex for Union Pay Credit cards with 81 ra…
shreyassai123 Sep 26, 2021
b069167
feat(isAlpha, isAlphanumeric): Adds Hindi (hi-IN) language support ad…
mikr13 Sep 26, 2021
a3497bd
fix(isEmail): replace all dots in gmail length validation (#1718)
DasDingGehtNicht Sep 26, 2021
326cfb9
feat(isURL): add `allow_fragments` and `allow_query_components` (#1721)
cowboy-bebug Sep 26, 2021
c899b31
feat(isMobilePhone): add validation for Venezuela phone numbers (#172…
islasjuanp Sep 26, 2021
05e382b
refactor: run scripts in parallel for build and clean (#1747)
sachinraja Oct 2, 2021
04b73ad
feat(isEmail): add `host_blacklist` option (#1641)
fedeci Oct 2, 2021
f2a1587
feat(isIdentityCard): Add PL locale (#1745)
wiktorwojcik112 Oct 2, 2021
4ec30b7
fix(isMobilePhone.js): regex for Belgium locale (#1746)
divikshrivastava Oct 2, 2021
13651ea
feat(isUrl): higher priority to whitelist (#1748)
deepanshu2506 Oct 5, 2021
622184e
feat(isFQDN): add `allow_wildcard` option (#1647)
fasenderos Oct 30, 2021
6b213cf
fix(isMobilePhone): use a loose and future-oriented way to verify Chi…
yisibl Oct 30, 2021
60dffb9
fix(isUrl): allow url with column and no port (#1751)
MatteoPierro Oct 30, 2021
29ed3a0
feat(isMobilePhone): add Cuba validation (#1765)
pasagedev Oct 30, 2021
9347d6d
fix(isUUID): fix for null version argument supply (#1777)
theteladras Oct 30, 2021
050a424
fix(isMobilePhone): regex for Pakistan(PK) (#1778)
hammad20120 Oct 30, 2021
5ed7db1
fix(isMobilePhone): update Sri Lanka locale (#1785)
Madhavi96 Oct 30, 2021
dc9f843
feat(isIdentityCard): add 'LK' (Sri Lanka) locale (#1786)
nimanthadilz Oct 30, 2021
8451206
feat(isPostalCode): add `LK` (Sri Lanka) locale (#1788)
nimanthadilz Oct 30, 2021
526417a
feat(isLicensePlate): add finnish locale (#1790)
Marcholio Oct 30, 2021
6eed6a4
fix(isFQDN): check more special chars (#1799)
MatteoPierro Oct 30, 2021
a837e6f
fix(isPassportNumber): update Poland country code (#1809)
Ronqn Oct 30, 2021
ba4106f
fix(isMobilePhone): update Hungarian locale (#1826)
danielTiringer Oct 30, 2021
c42b2d9
feat(isMobilePhone): add Bermuda en-BM locale (#1769)
HackProAIT Oct 30, 2021
7835db1
fix(docs): add missing locale (#1845)
profnandaa Oct 30, 2021
28f899d
feat(isUrl): urls with empty user (#1833)
MiguelSavignano Oct 30, 2021
3fcf768
fix(unescape): fixed bug where intermediate string contains escaped c…
Marcholio Oct 30, 2021
2201869
feat: added finnish locale to isAlpha and isAlphanumeric (#1837)
Marcholio Oct 30, 2021
57cc14e
feat(isIdentityCard): add finnish locale (#1838)
Marcholio Oct 30, 2021
7bee611
add CDN use option with unpkg (#1844)
Oct 30, 2021
de1cb29
fix: Russian passport number regex (#1810)
Theta-Dev Oct 30, 2021
5773869
feat(isVAT): add dutch NL locale (#1825)
zeno4ever Oct 30, 2021
f2381e0
feat: (isMobilePhone): add Cameroon fr-CM locale (#1772)
tarob0ba Oct 31, 2021
769f6d5
feat(contains): add possibility to check that string contains seed mu…
Marcholio Oct 31, 2021
af2b43c
feat(isUUID): add support for validation of version v1 and v2 (#1848)
theteladras Oct 31, 2021
01d3da3
feat(isMobilePhone): add Tajikistan tg-TJ locale (#1846)
mgnss Oct 31, 2021
fc0fefc
feat(isMobilePhone): add Bhutan dz-BT locale (#1770)
lakshayr003 Oct 31, 2021
5c2d69e
feat(isMobilePhone): regex for Burkina Faso fr-BF and Namibia en-NA l…
ZeeMangena Oct 23, 2021
c96d805
feat(isMobilePhone): add Maldives dv-MV locale
beprajwal Oct 25, 2021
ed60123
feat(isMobilePhone): add Tajikistan tg-TJ locale (#1846)
mgnss Oct 31, 2021
8627e48
feat(isMobilePhone): add Kiribati en-KI locale
c-tanner Oct 22, 2021
f7ff349
feat(isMobilePhone): add Frech Polynesia fr-PF locale
hereje Oct 16, 2021
0e5d5d4
feat(isMobilePhone): add Guyana en-GY locale
mfkrause Oct 12, 2021
26605f9
feat(isMobilePhone): add Turkmenistan tk-TM
husan-eshonqulov Oct 12, 2021
a3faa83
feat(isMobilePhone): add Botswana en-BW locale
mgndolan Oct 10, 2021
5b06703
feat(isMobilePhone): add Palestine ar-PS locale
brendan-c Oct 9, 2021
f17e220
feat(isMobilePhone): add El Salvador es-SV locale
hereje Oct 9, 2021
83cb7f8
chore: merge conflict clean-up
profnandaa Oct 31, 2021
45901ec
Merge pull request #1851 from validatorjs/chore/fix-merge-conflicts
profnandaa Oct 31, 2021
496fc8b
fix(rtrim): remove regex to prevent ReDOS attack (#1738)
tux-tn Nov 1, 2021
47ee5ad
13.7.0
profnandaa Nov 1, 2021
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
Prev Previous commit
Next Next commit
feat(isLicensePlate): Add Czech license plates (#1565)
* Add Czech license plates to the RegEx mix

* Reorder list

* Update README

* Add tests

* Remove trailing space

* Add more tests
  • Loading branch information
filiptronicek authored Jul 16, 2021
commit c87956ac3834201c9e05f0e93299a370ff2dd2d9
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ Validator | Description
**isJWT(str)** | check if the string is valid JWT token.
**isLatLong(str [, options])** | check if the string is a valid latitude-longitude coordinate in the format `lat,long` or `lat, long`.<br/><br/>`options` is an object that defaults to `{ checkDMS: false }`. Pass `checkDMS` as `true` to validate DMS(degrees, minutes, and seconds) latitude-longitude format.
**isLength(str [, options])** | check if the string's length falls in a range.<br/><br/>`options` is an object which defaults to `{min:0, max: undefined}`. Note: this function takes into account surrogate pairs.
**isLicensePlate(str [, locale])** | check if string matches the format of a country's license plate.<br/><br/>(locale is one of `['de-DE', 'de-LI', 'pt-PT', 'sq-AL', 'pt-BR'']` or `any`).
**isLicensePlate(str [, locale])** | check if string matches the format of a country's license plate.<br/><br/>(locale is one of `['cs-CZ', 'de-DE', 'de-LI', 'pt-PT', 'sq-AL', 'pt-BR']` or `any`)
**isLocale(str)** | check if the string is a locale
**isLowercase(str)** | check if the string is lowercase.
**isMACAddress(str)** | check if the string is a MAC address.<br/><br/>`options` is an object which defaults to `{no_separators: false}`. If `no_separators` is true, the validator will allow MAC addresses without separators. Also, it allows the use of hyphens, spaces or dots e.g '01 02 03 04 05 ab', '01-02-03-04-05-ab' or '0102.0304.05ab'.
Expand Down
2 changes: 2 additions & 0 deletions src/lib/isLicensePlate.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import assertString from './util/assertString';

const validators = {
'cs-CZ': str =>
/^(([ABCDEFHKIJKLMNPRSTUVXYZ]|[0-9])-?){5,8}$/.test(str),
'de-DE': str =>
/^((AW|UL|AK|GA|AÖ|LF|AZ|AM|AS|ZE|AN|AB|A|KG|KH|BA|EW|BZ|HY|KM|BT|HP|B|BC|BI|BO|FN|TT|ÜB|BN|AH|BS|FR|HB|ZZ|BB|BK|BÖ|OC|OK|CW|CE|C|CO|LH|CB|KW|LC|LN|DA|DI|DE|DH|SY|NÖ|DO|DD|DU|DN|D|EI|EA|EE|FI|EM|EL|EN|PF|ED|EF|ER|AU|ZP|E|ES|NT|EU|FL|FO|FT|FF|F|FS|FD|FÜ|GE|G|GI|GF|GS|ZR|GG|GP|GR|NY|ZI|GÖ|GZ|GT|HA|HH|HM|HU|WL|HZ|WR|RN|HK|HD|HN|HS|GK|HE|HF|RZ|HI|HG|HO|HX|IK|IL|IN|J|JL|KL|KA|KS|KF|KE|KI|KT|KO|KN|KR|KC|KU|K|LD|LL|LA|L|OP|LM|LI|LB|LU|LÖ|HL|LG|MD|GN|MZ|MA|ML|MR|MY|AT|DM|MC|NZ|RM|RG|MM|ME|MB|MI|FG|DL|HC|MW|RL|MK|MG|MÜ|WS|MH|M|MS|NU|NB|ND|NM|NK|NW|NR|NI|NF|DZ|EB|OZ|TG|TO|N|OA|GM|OB|CA|EH|FW|OF|OL|OE|OG|BH|LR|OS|AA|GD|OH|KY|NP|WK|PB|PA|PE|PI|PS|P|PM|PR|RA|RV|RE|R|H|SB|WN|RS|RD|RT|BM|NE|GV|RP|SU|GL|RO|GÜ|RH|EG|RW|PN|SK|MQ|RU|SZ|RI|SL|SM|SC|HR|FZ|VS|SW|SN|CR|SE|SI|SO|LP|S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ID|MYK|MSE|MST|MÜR|WRN|MEI|GRH|RIE|MZG|MIL|OBB|BED|FLÖ|MOL|FRW|SEE|SRB|AIB|MOS|BCH|ILL|SOB|NMS|NEA|SEF|UFF|NEW|VOH|NDH|TDO|NWM|GDB|GVM|WIS|NOM|EIN|GAN|LAU|HEB|OHV|OSL|SFB|ERB|LOS|BSK|KEL|BSB|MEL|WTL|OAL|FÜS|MOD|OHZ|OPR|BÜR|PAF|PLÖ|CAS|GLA|REG|VIT|ECK|SIM|GOA|EMS|DIZ|GOH|RÜD|SWA|NES|KÖN|MET|LRO|BÜZ|DBR|ROS|TET|HRO|ROW|BRV|HIP|PAN|GRI|SHK|EIS|SRO|SOK|LBS|SCZ|MER|QFT|SLF|SLS|HOM|SLK|ASL|BBG|SBK|SFT|SHG|MGN|MEG|ZIG|SAD|NEN|OVI|SHA|BLB|SIG|SON|SPN|FOR|GUB|SPB|IGB|WND|STD|STA|SDL|OBG|HST|BOG|SHL|PIR|FTL|SEB|SÖM|SÜW|TIR|SAB|TUT|ANG|SDT|LÜN|LSZ|MHL|VEC|VER|VIE|OVL|ANK|OVP|SBG|UEM|UER|WLG|GMN|NVP|RDG|RÜG|DAU|FKB|WAF|WAK|SLZ|WEN|SOG|APD|WUG|GUN|ESW|WIZ|WES|DIN|BRA|BÜD|WHV|HWI|GHC|WTM|WOB|WUN|MAK|SEL|OCH|HOT|WDA)[- ]?(([A-Z][- ]?\d{1,4})|([A-Z]{2}[- ]?\d{1,3})))[- ]?(E|H)?$/.test(str),
'de-LI': str => /^FL[- ]?\d{1,5}[UZ]?$/.test(str),
Expand Down
25 changes: 25 additions & 0 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -10696,6 +10696,31 @@ describe('Validators', () => {
'AAA 00 AAA',
],
});
test({
validator: 'isLicensePlate',
args: ['cs-CZ'],
valid: [
'ALA4011',
'4A23000',
'DICTAT0R',
'VETERAN',
'AZKVIZ8',
'2A45876',
'DIC-TAT0R',
],
invalid: [
'',
'invalidlicenseplate',
'LN5758898',
'X-|$|-X',
'AE0F-OP4',
'GO0MER',
'2AAAAAAAA',
'FS AB 1234 E',
'GB999 9999 00',
],
});

test({
validator: 'isLicensePlate',
args: ['pt-BR'],
Expand Down