项目作者: arashmanteghi

项目描述 :
Simple implementation of Iranian national code validation
高级语言: JavaScript
项目地址: git://github.com/arashmanteghi/national-code.git
创建时间: 2018-02-09T21:59:51Z
项目社区:https://github.com/arashmanteghi/national-code

开源协议:MIT License

下载


National Code

Simple library to validate Iranian national code.

Install

Install with npm or Yarn:

npm:

  1. npm install national-code --save

Yarn (note that yarn add automatically saves the package to the dependencies in package.json):

  1. yarn add national-code

Usage

  1. import nationalCode from 'natioanl-code';
  2. nationalCode(4839941637); // => true
  3. nationalCode(4839941638); // => false
  4. nationalCode('4839941637'); // => true
  5. nationalCode('4839941638'); // => false
  6. nationalCode('2222222222'); // => false
  7. nationalCode(3333333333); // => false

or:

  1. var nationalCode = require('national-code');
  2. nationalCode('4839941637'); // => true

Lunch demo as indepented project

  1. git clone https://github.com/arashmanteghi/national-code.git
  2. Run npm install
  3. Start the http-server using npm start
  4. Open http://localhost:9000

Commands

  • npm start - start the http-server
  • npm run build - build as production
  • npm run lint - run an ESLint check
  • npm run coverage - run code coverage and generate report in the coverage folder
  • npm test - run all tests
  • npm run test:watch - run all tests in watch mode

Licence

national-code is available under MIT.