national-code
v0.2.0
Published
Simple library to validate Iranian national code.
Downloads
4
Maintainers
Readme
National Code
Simple library to validate Iranian national code.
Install
npm:
npm install national-code --save
Yarn (note that yarn add
automatically saves the package to the dependencies
in package.json
):
yarn add national-code
Usage
import nationalCode from 'natioanl-code';
nationalCode(4839941637); // => true
nationalCode(4839941638); // => false
nationalCode('4839941637'); // => true
nationalCode('4839941638'); // => false
nationalCode('2222222222'); // => false
nationalCode(3333333333); // => false
or:
var nationalCode = require('national-code');
nationalCode('4839941637'); // => true
Lunch demo as indepented project
git clone https://github.com/arashmanteghi/national-code.git
- Run
npm install
- Start the http-server using
npm start
- Open http://localhost:9000
Commands
npm start
- start the http-servernpm run build
- build as productionnpm run lint
- run an ESLint checknpm run coverage
- run code coverage and generate report in thecoverage
foldernpm test
- run all testsnpm run test:watch
- run all tests in watch mode
Licence
national-code is available under MIT.