smart-id-validator
Version:
A package to validate official document numbers and other IDs format for various countries.
34 lines (33 loc) • 1.14 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.validatePhoneNumber = validatePhoneNumber;
exports.validateCNIC = validateCNIC;
exports.validatePassport = validatePassport;
const PK_1 = require("./validators/PK");
function validatePhoneNumber(phoneNumber, country) {
switch (country.toLowerCase()) {
case 'pk':
return (0, PK_1.validatePhoneNumberPK)(phoneNumber);
// Add cases for other countries here
default:
throw new Error(`Unsupported country: ${country}`);
}
}
function validateCNIC(cnic, country) {
switch (country.toLowerCase()) {
case 'pk':
return (0, PK_1.validateCNICPK)(cnic);
// Add cases for other countries here
default:
throw new Error(`Unsupported country: ${country}`);
}
}
function validatePassport(passport, country) {
switch (country.toLowerCase()) {
case 'pk':
return (0, PK_1.validatePassportPK)(passport);
// Add cases for other countries here
default:
throw new Error(`Unsupported country: ${country}`);
}
}