UNPKG
lorehub
Version:
latest (0.2.2)
0.2.2
0.2.1
0.2.0
0.1.0
Capture and surface the collective wisdom of your codebase
github.com/RoeeJ/lorehub
RoeeJ/lorehub
lorehub
/
src
/
utils
/
uuid.ts
8 lines
•
254 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
// Simple UUID v4 generator
export
function
v4
(
): string {
return
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
.
replace
(
/[xy]/g
,
(
c
) =>
{
const
r = (
Math
.
random
() *
16
) |
0
;
const
v = c ===
'x'
? r : (r &
0x3
) |
0x8
;
return
v.
toString
(
16
); }); }