Files
Cyrene_v2/frontend/web/src/lib/util.ts
T

13 lines
373 B
TypeScript

/** Generate a reasonably-unique id without external deps. */
export function uid(): string {
if (typeof crypto !== "undefined" && "randomUUID" in crypto) {
return crypto.randomUUID();
}
return `id-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
}
/** Current epoch milliseconds. */
export function now(): number {
return Date.now();
}