JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9
  • Score
    100M100P100Q66508F
  • License MIT

European license plate validator (Russia excluded).Syntax-only validation via regex for multiple EU/EEA countries including Italy, UK, Germany, France, Spain and more.Supports Node.js (TypeScript package) and PHP library.

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.


@codecorn/euro-plate-validator npm downloads jsDelivr GitHub stars

CI Tests issues min minzip Types module cdn License


โœจ 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

Usa URL versionati per evitare cache vecchie del CDN. Sostituisci 1.0.5 con 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
  • 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

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-validator

PHP

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 --pretty

Opzioni:

  • --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โ„ข ๐Ÿš€