Usa crypto.randomUUID() per generare un UUID v4. Questa API funziona in Bun, Node.js e browser. Non richiede dipendenze.
ts
crypto.randomUUID();
// => "123e4567-e89b-42d3-a456-426614174000"In Bun, puoi anche usare Bun.randomUUIDv7() per generare un UUID v7.
ts
Bun.randomUUIDv7();
// => "0196a000-bb12-7000-905e-8039f5d5b206"Vedi Docs > API > Utils per altre utilità utili.