/
githubmirror
/
client
Обзор
Документация
Войти
/
githubmirror
/
client
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
shared/util/uuid.tsx
14 строк
666 B
chrisnojima-zoom
Version 670 - clean2 (#29122)
08 июн 2026, 19:31
Не верифицирован
08 июн 2026, 19:31
1943197
Код
Авторство
О чём код?
// RPC expects a string that's interpreted as [16]byte on Go side and it has to // be unique among all ongoing ops at any given time. uuidv1 may exceed 16 // bytes, so just roll something simple that's seeded with time. // // MAX_SAFE_INTEGER after toString(36) is 11 characters, so the seed takes <= // 12 chars, and the counter below takes <= 4 chars (36^4), giving <= 16 total. const uuidSeed = Date.now().toString(36) + '-' let counter = 0 // We have 36^4=1,679,616 values to work with for the counter portion. const counterMod = 36 * 36 * 36 * 36 export const makeUUID = () => { counter = (counter + 1) % counterMod return uuidSeed + counter.toString(36) }