1.1.1 • Published 5 months ago

ausweischeck v1.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

AusweisCheck 🇩🇪 (EU-ID Card Check)

NPM NPM GitHub Workflow Status styled with prettier Quality Gate Status Maintainability Rating Security Bugs Coverage Duplicated Lines (%)

✨ Features

Just plain typescript lib to check the validity of German ID card and passport numbers with the help of the serial number. Special thanks to Deniz Celebi (@derDeno) for the original implementation.

🔧 Installation

npm install ausweischeck
yarn add ausweischeck

🎬 Getting started

import { checkPerso, checkReisepass } from "ausweischeck";

const persoResult = checkPerso("L01X00T471");
const reisepassResult = checkReisepass("C01X00T478D", "en");

📜 API

checkPerso(idNumber: string, language?: "de" | "en"): AusweisCheckResult

This method checks for the validity of a German Personalausweis (ID card) number. The language parameter is optional and defaults to "de". The language parameter is only used for the error message.

Example:

const persoResult = checkPerso("L01X00T471");

console.log(persoResult);
// {
//   result: true,
//   ausweis: {
//     number: "L01X00T47",
//     type: "EU ID",
//   },
// }

checkEuId(idNumber: string): AusweisCheckResult

This method duplicates the checkPerso method. It defaults to the English error message. It's only there for usability reasons.

checkReisepass(idNumber: string, language?: "de" | "en"): AusweisCheckResult

This method checks for the validity of a German Reisepass (passport) number. The language parameter is optional and defaults to "de". The language parameter is only used for the error message.

Example:

const reisepassResult = checkReisepass("C01X00T478D");

console.log(reisepassResult);
// {
//   result: true,
//   ausweis: {
//     number: "C01X00T478",
//     type: "Passport",
//   },
// }

checkGermanPassport(idNumber: string): AusweisCheckResult

This method duplicates the checkReisepass method. It defaults to the English error message. It's only there for usability reasons.

🥂 License

MIT

1.1.1

5 months ago

1.0.2

6 months ago

1.0.1

11 months ago

1.0.0

11 months ago