所有项目

HSC

Human Short Code (HSC)

已发布

厌倦了毫无意义的 ID?HSC 能安全地将难以复制的 ID 转换为人性化可读格式

示例

$ npm i human-short-code
import { hsc } from "human-short-code";

const myNumber = 123456789;

// Encode number to short code
const shortCode = hsc.encode(myNumber);
console.log(shortCode); // Example output: "QIUN-ESAD"

// Decode short code back to number
const originalNumber = hsc.decode(shortCode);
console.log(originalNumber); // 123456789

// Verify if a code is valid
const isValid = hsc.verify(shortCode);
console.log(isValid); // true