mirror of
https://github.com/morris/vanilla-todo.git
synced 2025-08-22 05:33:06 +02:00
refactor for pure functional business logic
This commit is contained in:
8
public/scripts/uuid.js
Normal file
8
public/scripts/uuid.js
Normal file
@@ -0,0 +1,8 @@
|
||||
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);
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user