infinity-forge
Version:
13 lines • 712 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateGUID = generateGUID;
function generateGUID() {
function getRandomHexByte() {
return Math.floor(Math.random() * 256).toString(16).padStart(2, '0');
}
var bytes = Array.from({ length: 16 }, getRandomHexByte);
bytes[6] = (parseInt(bytes[6], 16) & 0x0f | 0x40).toString(16);
bytes[8] = (parseInt(bytes[8], 16) & 0x3f | 0x80).toString(16);
return "".concat(bytes.slice(0, 4).join(''), "-").concat(bytes.slice(4, 6).join(''), "-").concat(bytes.slice(6, 8).join(''), "-").concat(bytes.slice(8, 10).join(''), "-").concat(bytes.slice(10, 16).join(''));
}
//# sourceMappingURL=generate-guid.js.map