All Projects → imdreamrunner → js-id-number

imdreamrunner / js-id-number

Licence: other
JavaScript ID Number Toolkit | A collection of identification number validators with uniform interfaces for JavaScript.

Programming Languages

typescript
32286 projects
HTML
75241 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to js-id-number

imrc-datetime-picker
(Improved) React component datetime picker by momentjs 📆
Stars: ✭ 21 (-4.55%)
Mutual labels:  npm-package
react-native-input-prompt
A cross-platform user input prompt component for React Native with Native UI.
Stars: ✭ 45 (+104.55%)
Mutual labels:  npm-package
split-on-first
Split a string on the first occurrence of a given separator
Stars: ✭ 68 (+209.09%)
Mutual labels:  npm-package
windows-network-drive
Do network drive stuff on Microsoft Window in node
Stars: ✭ 18 (-18.18%)
Mutual labels:  npm-package
TypeScript-Library-Checklist
Your pre-launch checklist.
Stars: ✭ 19 (-13.64%)
Mutual labels:  npm-package
html-to-react
A lightweight library that converts raw HTML to a React DOM structure.
Stars: ✭ 696 (+3063.64%)
Mutual labels:  npm-package
frontatish
A React native common components kit and helper methods,find the package at this link https://www.npmjs.com/package/frontatish
Stars: ✭ 14 (-36.36%)
Mutual labels:  npm-package
weak-merge
🔗 A module for merging WeakSets and WeakMaps.
Stars: ✭ 20 (-9.09%)
Mutual labels:  npm-package
typescript-npm-package-template
Boilerplate to kickstart creating an npm package using TypeScript
Stars: ✭ 122 (+454.55%)
Mutual labels:  npm-package
ostrio-analytics
📊 Visitor's analytics tracking code for ostr.io service
Stars: ✭ 14 (-36.36%)
Mutual labels:  npm-package
js-module-system
A small UI library to demonstrate the JS module system
Stars: ✭ 36 (+63.64%)
Mutual labels:  npm-package
sdbm
SDBM non-cryptographic hash function
Stars: ✭ 43 (+95.45%)
Mutual labels:  npm-package
1broker-client
Complete node.js client for 1Broker API, open sourced by @telebroker_bot for Telegram!
Stars: ✭ 19 (-13.64%)
Mutual labels:  npm-package
retryx
Promise-based retry workflow library.
Stars: ✭ 21 (-4.55%)
Mutual labels:  npm-package
create-xo
Add XO to your project
Stars: ✭ 41 (+86.36%)
Mutual labels:  npm-package
example-typescript-package
Example TypeScript Package ready to be published on npm & Tutorial / Instruction / Workflow for 2021
Stars: ✭ 71 (+222.73%)
Mutual labels:  npm-package
electron-remote-dashboard
Remote dashboard with a control app
Stars: ✭ 14 (-36.36%)
Mutual labels:  npm-package
ngx-deploy-npm
Publish your libraries to NPM with just one command
Stars: ✭ 70 (+218.18%)
Mutual labels:  npm-package
react-windows-ui
Build Windows fluent UI apps using ReactJS. Provides a set of accessible, reusable, and composable React components that make it super easy to create websites and apps.
Stars: ✭ 383 (+1640.91%)
Mutual labels:  npm-package
googlesheetstojson
An npm package to read Google Sheets data and convert it to JSON without publishing it to the web
Stars: ✭ 24 (+9.09%)
Mutual labels:  npm-package

id-number: JavaScript ID Number Toolkit

JavaScript ID Number Toolkit

JavaScript ID Number Toolkit is a collection of validators of identity document number for JavaScript applications.

Visit the DEMO website!

Build Status NPM Version NPM Downloads Internet Explorer Google Chrome Firefox Safari

Usage

Installation

You can install IDNumber by

  • directly import in browser

    <script src="IDNumber.js"></script>
    <!-- Please edit the URL above. -->

    Download latest build.

    A CDN for this file is available at:

    https://unpkg.com/id-number/dist/browser/IDNumber.js
    
  • using in node.js or webpack

    The library is available at NPM with name id-number.

    You can import it via require.

    const IDNumber = require('id-number');

    Or in ES6 style.

    import IDNumber from 'id-number';

ID Number Validation

const validator = IDNumber.getValidator('SG', 'NRIC');
const result = validator('S0980292D');

And the result is in format:

{
    'success': true or false,
    'reason': string if the result is false
}

ID Number Generation

const generator = IDNumber.getValidator('CN', 'ID');
const result = generator();

And the result is in format:

{
    'value': 466311201110053638,
    'extra': {"province":"海南","birthday":"2011-10-05","gender":"Male"}
}

Available Validators

Country Document
SG (Singapore) NRIC
TW (Taiwan) ID (身份證字號)
CN (China) ID (居民身份证号码)

Development

To build: npm run build

To test: npm test

Add support for new identity documentations

Step 1: Write the validator / generator in TypeScript in the directory src/providers/<name>.ts. The validator shall be a function returning a InternalValidateResult.

Step 2: Register the validator / generator in src/IDNumber.ts

Step 3: Write test cases at src/<name>.spec.ts.

Step 4: Send a pull request to this repository.

Thank you for the contributions.

Demo Website

The source code for demo website (id-number.dreamrunner.space) locates at the demo folder.

To deploy, go into demo folder and type yarn deploy if you have permission.

Bonus

We have a very good wiki that explain the algorithm of the ID number checksum used by different identity documents.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].