Passport
import { validatePassport } from 'pakdatakit/passport'
Checks that a passport number has the common shape: two letters followed by seven digits, such as AB1234567. Case, surrounding spaces, and spaces or dashes between the letters and digits are ignored.
validatePassport() Common shape
Examples
Section titled “Examples”import { validatePassport } from 'pakdatakit';
validatePassport('AB1234567');// → true
validatePassport('ab 1234567');// → true
validatePassport('A12345678');// → falsefrom pakdatakit import validate_passport
validate_passport('AB1234567')# → True
validate_passport('ab 1234567')# → True
validate_passport('A12345678')# → Falseimport 'package:pakdatakit/pakdatakit.dart';
validatePassport('AB1234567');// → true
validatePassport('ab 1234567');// → true
validatePassport('A12345678');// → falseusing PakDataKit;
Passport.Validate("AB1234567");// → true
Passport.Validate("ab 1234567");// → true
Passport.Validate("A12345678");// → falseuse PakDataKit\Passport;
Passport::validate('AB1234567');// → true
Passport::validate('ab 1234567');// → true
Passport::validate('A12345678');// → falseReference
Section titled “Reference”validatePassport()
Section titled “validatePassport()”function validatePassport(passport: string): boolean;Parameters. passport: the passport number. Case, surrounding spaces and spaces or dashes between the letters and digits are ignored.
Returns true when the number is two letters followed by seven digits; otherwise false.
Caveats. Two letters and seven digits is the number format given for the 2013 ordinary passport in the EU’s PRADO register, and it fits the 9-character document-number field of ICAO Doc 9303. The letters’ meaning is not documented and is not checked. The MRZ check digit is not part of the number.
Related: CNIC.
Related
Section titled “Related”- CNIC, the other identity number most forms ask for.
- API reference for
pakdatakit/passport.