This commit is contained in:
Luiz Silva 2024-05-06 08:45:08 -03:00
commit b5ca2d50ac
337 changed files with 24672 additions and 0 deletions

15
src/uuid.ts Normal file
View file

@ -0,0 +1,15 @@
//Gerar uma uuid V4
const letras = "0123456789abcdef".split("");
export const uuid = () => {
letras.sort(() => Math.random() - 0.5);
const modelo = "xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx".split("");
const retorno = modelo
.map((letra) =>
letra === "x"
? letras[((1000 * Math.random()) | 0) % letras.length]
: letra,
)
.join("");
return retorno;
};