degachejs
Version:
A Tunisian utility library for working with CIN, phone numbers, addresses, and more
17 lines (16 loc) • 514 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateCIN = void 0;
/**
* Regular expression for CIN validation
*/
const CIN_REGEX = /^[01]\d{7}$/; // 0 or 1 followed by 7 digits to match the tunisian CIN format
/**
* Validates a Tunisian CIN (Carte d'Identité Nationale)
* @param cin - The CIN number to validate
* @returns boolean indicating if the CIN is valid
*/
const validateCIN = (cin) => {
return CIN_REGEX.test(cin);
};
exports.validateCIN = validateCIN;