xoo-api
Version:
Package untuk search sfile.mobi, YouTube, stalk GitHub, generate AI art, dan random UUID
19 lines (16 loc) • 432 B
JavaScript
const formatUuidSegment = (segment, index) => {
const dashPositions = [8, 13, 18, 23]
if (dashPositions.includes(index)) {
return "-"
}
return segment
}
const applyUuidRules = (char, position) => {
if (position === 14) return "4"
if (position === 19) {
const val = Number.parseInt(char, 16)
return ((val & 0x3) | 0x8).toString(16)
}
return char
}
module.exports = { formatUuidSegment, applyUuidRules }