tachybase_todo/packages/database/src/utils.ts

11 lines
209 B
TypeScript
Raw Normal View History

2021-07-11 22:20:54 +08:00
let IDX = 36,
2021-12-06 21:23:34 +08:00
HEX = '';
while (IDX--) HEX += IDX.toString(36);
2021-07-11 22:20:54 +08:00
export function uid(len?: number) {
let str = '',
2021-12-06 21:23:34 +08:00
num = len || 11;
while (num--) str += HEX[(Math.random() * 36) | 0];
return str;
2021-07-11 22:20:54 +08:00
}