Files
faunosteo/docs/faunosteo-audit/relevant-files/src/lib/id.ts
T
bastien e471d41c6b docs(docs): add anatomical audit of existing SVG, catalog and report systems
Read-only technical audit before the SaaS redesign: 13 reports,
a logical anatomical-sheet JSON built from real horse data, verbatim
copies of the 52 relevant source files, and a self-contained ZIP.
2026-10-06 23:51:35 +02:00

14 lines
387 B
TypeScript

/**
* Generates a collision-resistant unique id using crypto.randomUUID().
* Falls back to a timestamp-based id in environments without crypto.
*/
export function generateId(): string {
if (
typeof crypto !== 'undefined' &&
typeof crypto.randomUUID === 'function'
) {
return crypto.randomUUID()
}
return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
}