@cedric0303/id-generator
v0.2.1
Published
ID generators for SG and HK
Downloads
650
Readme
@cedric0303/id-generator
Installation
Install globally to use sgid
or hkid
:
npm install --global @cedric0303/id-generator
yarn global add @cedric0303/id-generator
bun add --global @cedric0303/id-generator
Install locally to use in projects:
npm install @cedric0303/id-generator
yarn add @cedric0303/id-generator
bun add @cedric0303/id-generator
Global Usage
> sgid
A5758052
> hkid
S8541816E
// output automatically copied to clipboard
See sgid --help
or hkid --help
for more details
Module/Programmatic Usage
@cedric0303/id-generato
r can be imported as a module:
import {
randomHKID,
randomSGID,
isValidHKID,
isValidSGID
} from "@cedric0303/id-generator";
const hkid = await randomHKID();
const sgid = await randomSGID();
console.log(hkid, isValidHKID(hkid));
console.log(sgid, isValidSGID(sgid));
Acknowledgements
This project incorporates code from the following projects:
- hkid-generator by icelam (License: ISC)
- singapore-nric by samliew (License: MIT)