perso-validator
v1.0.1
Published
Validate a german personalausweis/id
Downloads
3
Readme
perso-validator
How to use
npm install perso-validator
import {parse} from 'perso-validator';
const PERSO_ID = 'T220001293'
const PERSO_DOB = '6408125'
const PERSO_EXPIRY = '2010315D'
const parseResult = parse(PERSO_ID, PERSO_DOB, PERSO_EXPIRY, {minAge: 18})
Available methods
validatePersoId: (id: string) => boolean;
validateDateOfBirth: (id: string) => boolean;
validateExpiryDate: (id: string) => boolean;
getBirthdateFromId: (id: string, minAge?: number) => Date | boolean;
getValidUntilDateFromId: (id: string) => Date;
checkIfExpired: (expiryDate: Date) => boolean;
parse: (
persoId: string,
persoDateOfBirth: string,
persoExpiryDate: string,
options?: PersoParserOptions
) => {
isValid: boolean;
validDateOfBirth: boolean;
isExpired: boolean;
expiryDate: Date | boolean;
birthdate: Date | boolean;
};
Running tests
npm run test