IRCheck is a Node.js validation library developed for Iranian developers in order to help them to do some validations on their specific national data.
You can install the package via the following command:
npm install ircheck
First you need to import the package:
const IRCheck = require('ircheck');
Then you can use the available methods for different available validators:
IRCheck.Phone.checkType('02191001848'); //returns 'LANDLINE'
IRCheck.Phone.normalizeMobile('+989121234567'); // returns '9121234567'
IRCheck.Postal.isPostalCodeValid('7634598734'); // returns 'TRUE'
IRCheck.National.isNationalCodeValid('4721016352'); // returns 'TRUE'
Currently, the following validators are available:
Here’s a list of available methods:
checkType(number)
Check whether if a number is a type of mobile or landlineisMobile(number)
Verify the input number is a type of mobileisLandline(number)
Verify the input number is a type of landlinenormalizeMobile(number)
Normalize a mobile number as 9121234567normalizeLandline(number)
Normalize a landline number as 2191001848getProvinceData(province {String|Number})
Get province info from its area code or code namegetProvincesFromLandline(number)
Extract province data from a landline numbers
Here’s a list of available methods:
isPostalCodeValid(postalCode {String})
Check if the entered postal code is valid
Here’s a list of available methods:
isNationalCodeValid(nationalCode {String})
Check if the entered Iranian national code is valid
- Company national code validation has been added.
- Postal code validation has been added into the library.
- National code validation has been added into the library.
- Updating README.md file.
- A few changes in the main file.
- Fixing typo errors in README.md file.
- Initial release
Any contribution is much appreciated. Make sure that you write and run tests before submitting PR.
MIT licensed Copyright (C) 2017 Jeff Mosawy, http://jmosawy.com