Validate and decode information from an South African ID
Built with ❤︎ by Tiaan and contributors
$ npm install --save south-african-id-info
# OR
$ yarn add south-african-id-info
The module exports a single function that takes a number string
as argument and returns an object
.
const southAfricanIdInfo = require('south-african-id-info')
console.log(southAfricanIdInfo('9301215029086'))
// { valid: true,
// birthDate: 1993-01-20T22:00:00.000Z,
// gender: 'male', // 'female' //
// citizenship: 'SA citizen' // 'permanent resident'
// }
console.log(info('9202204720082'))
// { valid: false }
$ npm install --global south-african-id-info
# OR
$ yarn global add south-african-id-info
Then:
$ sa-id-info 9301215029086
# valid: true
# birthDate: Thu Jan 21 1993 00:00:00 GMT+0200 (SAST)
# gender: male
# citizenship: SA citizen
Contributions are welcome. Please open up an issue or create PR if you would like to help out.
Note: If editing the README, please conform to the standard-readme specification.
Licensed under the MIT License.