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
> sgid
A5758052
> hkid
S8541816E
// output automatically copied to clipboard
See sgid --help
or hkid --help
for more details
@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));
This project incorporates code from the following projects:
- hkid-generator by icelam (License: ISC)
- singapore-nric by samliew (License: MIT)