south-african-id-info
v1.0.1
Published
Validate and decode information from an South African ID
Downloads
378
Maintainers
Readme
Install
$ npm install --save south-african-id-info
# OR
$ yarn add south-african-id-info
Usage
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 }
CLI
$ 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
Contribute
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.
License
Licensed under the MIT License.