MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / UUIDv4

Function UUIDv4

modules/base/uuid/uuid.js:57–67  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

55
56// Version 4 (Random) UUID
57function UUIDv4() {
58 return [
59 hex(Math.random() * 0xffffffff, 8),
60 hex(Math.random() * 0xffff, 4),
61 '4' + hex(Math.random() * 0xfff, 3),
62 hex(Math.random() * 0x3fff | 0x8000, 4),
63 hex(Math.random() * 0xffffffff, 8) + hex(Math.random() * 0xffff, 4),
64 ]
65 .join('-')
66 .toUpperCase();
67}
68
69function hex(value, count) {
70 if (value < 0) {

Callers 1

UUIDFunction · 0.85

Calls 1

hexFunction · 0.85

Tested by

no test coverage detected