tezx
Version:
TezX is a modern, ultra-lightweight, and high-performance JavaScript framework built specifically for Bun. It provides a minimal yet powerful API, seamless environment management, and a high-concurrency HTTP engine for building fast, scalable web applicat
18 lines (17 loc) • 593 B
JavaScript
export function generateID() {
const timestamp = Date.now().toString(16);
const randomHex = Math.floor(Math.random() * 0xffffffffffff).toString(16).padStart(12, "0");
return `${timestamp}-${randomHex}`;
}
export function generateUUID() {
return crypto.randomUUID();
}
export function generateRandomBase64(length = 16) {
let result = "";
const BASE64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
for (let i = 0; i < length; i++) {
const idx = Math.floor(Math.random() * 64);
result += BASE64[idx];
}
return result;
}