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.
npm install ausweischeck
yarn add ausweischeck
import { checkPerso, checkReisepass } from "ausweischeck";
const persoResult = checkPerso("L01X00T471");
const reisepassResult = checkReisepass("C01X00T478D", "en");
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",
// },
// }
This method duplicates the checkPerso method. It defaults to the English error message. It's only there for usability reasons.
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",
// },
// }
This method duplicates the checkReisepass method. It defaults to the English error message. It's only there for usability reasons.