A JavaScript toolkit to handle Hong Kong Identity Card (HKID) numbers, validate and generate random HKID numbers.
- Validate HKID number
- Supports brackets!
() - No matter what case
aAbC
- Supports brackets!
- Generate Random HKID
npm install hkid-utilsor
yarn add hkid-utilsconst hkidUtils = require('hkid-utils');
// Validate HKID number
hkidUtils.validate('G123456(A)'); // true
hkidUtils.validate('aB987654(3)'); // true
hkidUtils.validate('X3459387'); // true
hkidUtils.validate('123(A)4') // false
// Generate random HKID number
hkidUtils.random(); // 'A123456(7)'-
Main Features
- Validate HKID number
- Generate random HKID number
- with "includeBrackets" option
-
DevOps
- GitHub Actions pipeline to release package to NPM
-
Compatibility
- ES5 (NodeJS)
- ES6 (Browser)
Your contributions are always welcome! Even if it's just a typo or a missing comma, we'll appreciate it.
- Fork the repository π΄
- Create a branch with your feature or bug fix π
- Commit your changes π½
- Create a pull request π§°