first commit
This commit is contained in:
13
pb_hooks/util.js
Normal file
13
pb_hooks/util.js
Normal file
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
uuidv4() {
|
||||
const uuid = new Array(36);
|
||||
for (let i = 0; i < 36; i++) {
|
||||
uuid[i] = Math.floor(Math.random() * 16)
|
||||
}
|
||||
uuid[14] = 4;
|
||||
uuid[19] = uuid[19] &= ~(1 << 2);
|
||||
uuid[19] = uuid[19] |= (1 << 3);
|
||||
uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
|
||||
return uuid.map(x => x.toString(16)).join('')
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user