1.0.3 • Published 3 years ago

sa-id-verification v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

SA-ID-Verification

Verify South African ID numbers and extract age, gender and citizen status.

installation

npm install sa-id-verification

Usage

import package and create an ID instance

import SouthAfricanID from 'sa-id-verification';
// id_number must be a 13 digit string
var south_african_id = new SouthAfricanID(id_number);

Verify Id

// check if the id number is valid using the luhn algorithm https://en.wikipedia.org/wiki/Luhn_algorithm
// returns boolean value 
var is_id_valid = south_african_id.validId();

Extract gender

//  extract gender from id number, Male or Female
var gender = south_african_id.getGender();

Extract citizen status

//  extract citizen status from id number, SA citizen or Permanent resident
var citezen_status = south_african_id.getCitizenStatus();

Extract age

//  extract age from id number
var age = south_african_id.getAge();