1.0.3 • Published 5 years ago

lanka-nic-2019 v1.0.3

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

lanka-nic-2019

https://nodei.co/npm/lanka-nic-2019.png?downloads=true&downloadRank=true&stars=true

Sri Lankan NIC validator which supports both old and new NIC formats. This pacakge can be used to swap NIC, validate and get more info like, bday, gender etc..

Features

  • Validate NIC.
  • Swap NIC. (Old to new or new to old)
  • Extract NIC infromation. (Bday, Gender, etc..)

Installation

$ npm install lanka-nic-2019 --save

or

$ yarn add lanka-nic-2019 

How to use

  • First, require
const lankaNic = require('lanaka-nic-2019');

or import

import lankaNic from 'lanka-nic-2019';
  • Next, call the functions like:
lanakNic.infoNic('12345678912');
lanakNic.validateNic('12345678912');
lanakNic.swapNic('12345678912');

Supported methods

MethodInputOutput
validateNicString : Old or new NIC numberBool: true or false
swapNicString : Old or new NIC numberString : xxxxxxxxxv , Swap NIC old to new and vice versa. If entered Nic no. is incorrect will display 'incorrect format' error message.
infoNicString : Old or new NIC numberObject :
{
isValidated: true,
input: '123456789v',
format: 'old',
newFormat: '123456789000',
oldFormat: '123456789v',
nicLength: 10,
gender: 'Male',
character: 'v',
birthday: '05/05/1903'
}

Developing

Any modification, correction welcome

Prerequisites
  • NodeJS(6+)
  • EsLint supported editor.

Setting up

Clone the repo and run yarn install or npm install. Make sure you have an editor with an eslint plugin active. Never start working without eslint.

Testing

Before pushing the code, please check for errors:

npm run test

Versioning

We use SemVer for versioning. For the versions available, see the link to tags on this repository.

Style guide

Always follow the AirBnb Style Guide.

License

MIT licensed.

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago