sl-nic-validator
Version:
A library to validate Sri Lankan National Identity Card (NIC) numbers with birth date and gender detection.
7 lines (5 loc) • 423 B
JavaScript
const validateNIC = require("./index");
// Test cases
console.log(validateNIC("200012345678", "2000-05-02")); // { valid: true, message: "NIC is valid", gender: "Male" }
console.log(validateNIC("880012345V", "1988-01-12")); // { valid: true, message: "NIC is valid", gender: "Male" }
console.log(validateNIC("950045678V", "1995-02-14")); // { valid: false, message: "NIC and Birth Date do not match", gender: "Male" }