botv12/util/uuidtoint.js

6 lines
275 B
JavaScript
Raw Normal View History

2024-10-23 22:59:54 -04:00
export default function uuidToInt (uuid) {
2024-10-23 21:18:45 -04:00
const splitUUID = uuid.replace(/[^0-9a-f]/g, '').replace(/.{1,8}/g, a => { return `0x${a}` }).match(/.{1,10}/g)
const numUUID = [+splitUUID[0] << 0, +splitUUID[1] << 0, +splitUUID[2] << 0, +splitUUID[3] << 0]
return numUUID
2024-11-19 20:05:19 -05:00
}