11 lines
247 B
JavaScript
11 lines
247 B
JavaScript
|
const s4 = () => {
|
||
|
return Math.floor((1 + Math.random()) * 0x10000)
|
||
|
.toString(16)
|
||
|
.substring(1);
|
||
|
}
|
||
|
|
||
|
module.exports = function generateGUID() {
|
||
|
return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
|
||
|
s4() + '-' + s4() + s4() + s4();
|
||
|
}
|