Package Exports
- @codecorn/euro-plate-validator
- @codecorn/euro-plate-validator/browser
- @codecorn/euro-plate-validator/client
- @codecorn/euro-plate-validator/package.json
Readme
๐ @codecorn/euro-plate-validator
๐ European license plate validator (Russia excluded).
Multi-country regex-based syntax validation for EU/EEA license plates.
Supports Node.js (TypeScript/JavaScript) and PHP implementations.
โจ Features
- โ Multi-country support (25+ EU/EEA countries)
- ๐ซ Russia excluded by design
- ๐ Normalizes input (spaces, hyphens)
- ๐ฅ Available for Node.js/TypeScript and PHP
- ๐ฆ Ready to publish on npm
CDN quick links
Usa URL versionati per evitare cache vecchie del CDN. Sostituisci
1.0.5con lโultima.
ESM (browser)
- jsDelivr:
https://cdn.jsdelivr.net/npm/@codecorn/euro-plate-validator@1.0.5/dist/browser/index.esm.min.js - UNPKG:
https://unpkg.com/@codecorn/euro-plate-validator@1.0.5/dist/browser/index.esm.min.js
- jsDelivr:
IIFE (global
window.EuroPlate)- jsDelivr:
https://cdn.jsdelivr.net/npm/@codecorn/euro-plate-validator@1.0.5/dist/browser/index.iife.min.js - UNPKG:
https://unpkg.com/@codecorn/euro-plate-validator@1.0.5/dist/browser/index.iife.min.js
- jsDelivr:
Se vedi file non aggiornati, forza il purge:https://purge.jsdelivr.net/npm/@codecorn/euro-plate-validator@1.0.5/dist/browser/index.iife.min.js
๐ฆ Installation
Node.js / TypeScript
npm install @codecorn/euro-plate-validatorPHP
Scarica EuroPlateValidator.php nella tua codebase.
๐ Usage
Node.js / TypeScript
import { validatePlate } from "@codecorn/euro-plate-validator";
// Italy
console.log(validatePlate("AB 123 CD", ["IT"]));
// -> { isValid: true, matches: [{country:"IT", name:"Italy"}], checked:["IT"] }
// UK
console.log(validatePlate("AB12 CDE", ["UK", "IE"]));Esempi veloci:
import { validatePlate } from "./dist/index.js";
validatePlate("AB 123 CD", ["IT"], { vehicleType: "car" }); // โ
IT Car
validatePlate("AA 12345", ["IT"], { vehicleType: "motorcycle" }); // โ
IT Moto
validatePlate("AA 12345", ["IT"], { vehicleType: "car" }); // โ (no_match)Come si usa il toggle senza toccare il file
Abilita da HTML:
<script type="module" src="demo.js" data-europlate-debug="1"></script>
Oppure runtime:
enableEuroPlateDebug(true); // ON enableEuroPlateDebug(false); // OFF
Per un logger esterno (opzionale)
window.EuroPlateLogger = {
debug: (...a) => console.debug('[MYLOG]', ...a),
info: (...a) => console.info('[MYLOG]', ...a),
warn: (...a) => console.warn('[MYLOG]', ...a),
error: (...a) => console.error('[MYLOG]', ...a),
notify: (msg, type='info') => {
// integra con Sentry/Toast/Datadog/etc
}
};Cosรฌ tieni il codice pulito, i log โdi sviluppoโ sono a scomparsa e puoi innestare qualsiasi pipeline di logging quando vuoi, senza toccare il core.
PHP
require '_php_variant/EuroPlateValidator.php';
print_r(validate_plate("AB 123 CD", ["IT"], "car"));
print_r(validate_plate("AA 12345", ["IT"], "motorcycle"));๐ง CLI
npx @codecorn/euro-plate-validator "AB 123 CD" --countries IT,FR,DE --type car --prettyOpzioni:
--countries/-c: lista di country code (comma-sep)--type/-t:car|motorcycle|any(default:any)--pretty/-p: output leggibile
Exit code: 0 se valido, 1 se non valido, 2 argomenti errati.
Esempi CLI:
# Car IT
npx euro-plate-validator "AB 123 CD" --countries IT --type car --pretty
# Moto IT
npx euro-plate-validator "AA 12345" --countries IT --type motorcycle --pretty
# UK / IE
npx euro-plate-validator "AB12 CDE" --countries UK,IE --type any๐ Supported Countries
๐ฎ๐น IT | ๐ฌ๐ง UK | ๐ฉ๐ช DE | ๐ซ๐ท FR | ๐ช๐ธ ES | ๐ต๐น PT | ๐ณ๐ฑ NL | ๐ง๐ช BE | ๐จ๐ญ CH | ๐ฆ๐น AT | ๐ฎ๐ช IE | ๐ฑ๐บ LU ๐ฉ๐ฐ DK | ๐ธ๐ช SE | ๐ณ๐ด NO | ๐ซ๐ฎ FI | ๐ต๐ฑ PL | ๐จ๐ฟ CZ | ๐ธ๐ฐ SK | ๐ญ๐บ HU | ๐ท๐ด RO | ๐ง๐ฌ BG | ๐ธ๐ฎ SI | ๐ญ๐ท HR | ๐ฌ๐ท GR ๐ฑ๐น LT | ๐ฑ๐ป LV | ๐ช๐ช EE | ๐บ๐ฆ UA
๐ License
MIT ยฉ CodeCornโข
Distribuito sotto licenza MIT.
๐ค Maintainer
๐จโ๐ป Federico Girolami
Full Stack Developer | System Integrator | Digital Solution Architect ๐
๐ซ Get in Touch
๐ Website: codecorn.it *(Under Construction)*
๐ง Email: f.girolami@codecorn.it
๐ GitHub: github.com/fgirolami29
๐ค Contribute
Pull request benvenute. Per grosse modifiche apri una issue prima di iniziare.
Powered by CodeCornโข ๐