Skip to content
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

feat(isLicensePlate): hu-HU locale #1895

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,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 `['cs-CZ', 'de-DE', 'de-LI', 'fi-FI', 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', 'fi-FI', 'hu-HU', 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 [, options])** | 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'. The options also allow a `eui` property to specify if it needs to be validated against EUI-48 or EUI-64. The accepted values of `eui` are: 48, 64.
Expand Down
1 change: 1 addition & 0 deletions src/lib/isLicensePlate.js

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

70 changes: 70 additions & 0 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -11744,6 +11744,76 @@ describe('Validators', () => {
'AB123DC',
],
});
test({
validator: 'isLicensePlate',
args: ['hu-HU'],
valid: [
'AAB-001',
'AVC-987',
'KOC-124',
'JCM-871',
'AWQ-777',
'BPO-001',
'BPI-002',
'UCO-342',
'UDO-385',
'XAO-987',
'AAI-789',
'ABI-789',
'ACI-789',
'AAO-789',
'ABO-789',
'ACO-789',
'YAA-123',
'XAA-123',
'WAA-258',
'XZZ-784',
'M123456',
'CK 12-34',
'DT 12-34',
'CD 12-34',
'HC 12-34',
'HB 12-34',
'HK 12-34',
'MA 12-34',
'OT 12-34',
'RR 17-87',
'CD 124-348',
'C-C 2021',
'C-X 2458',
'X-A 7842',
'E-72345',
'Z-07458',
'S ACF 83',
'SP 04-68',
],
invalid: [
'AAA-547',
'aab-001',
'AAB 001',
'AB34',
'789-LKJ',
'BBO-987',
'BBI-987',
'BWQ-777',
'BQW-987',
'BAI-789',
'BBI-789',
'BCI-789',
'BAO-789',
'BBO-789',
'BCO-789',
'ADI-789',
'ADO-789',
'KOC-1234',
'M1234567',
'W-12345',
'S BCF 83',
'X-D 1234',
'C-D 1234',
'HU 12-34',
],
});
test({
validator: 'isLicensePlate',
args: ['any'],
Expand Down