INNER CODE UNIT · TypeScript

getDeviceUuid

beeequeue/yuna · src/utils/index.ts:119

export const getDeviceUuid = (): string => {
  if (existsSync(deviceUuidFilePath)) {
    return readFileSync(deviceUuidFilePath).toString()
  }

  const newUuid = uuid()
  writeFileSync(deviceUuidFilePath, newUuid)

  return newUuid
}

export const generateId = () => {
  const chars = "abcdefghijklmnopqrstuvwxyz1234567890"
  let id = ""

  for (let i = 0; i < 8; i++) {
    id += chars[Math.round(Math.random() * chars.length - 1)]
  }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…