1
0
mirror of https://github.com/morris/vanilla-todo.git synced 2025-08-21 05:11:20 +02:00
Files
vanilla-todo/public/scripts/uuid.js
2023-11-30 11:42:02 +01:00

9 lines
218 B
JavaScript

export function uuid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
const r = (Math.random() * 16) | 0,
v = c === 'x' ? r : (r & 0x3) | 0x8;
return v.toString(16);
});
}