/
githubmirror
/
client
Обзор
Документация
Войти
/
githubmirror
/
client
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
shared/constants/rpc-utils.tsx
29 строк
723 B
chrisnojima
less zust (#29314)
15 июн 2026, 16:55
Не верифицирован
15 июн 2026, 16:55
baeefd1
Код
Авторство
О чём код?
import * as T from './types' import type {Device} from './provision' import {uint8ArrayToString} from '@/util/uint8array' export const bodyToJSON = (body?: Uint8Array): unknown => { if (!body) return undefined try { return JSON.parse(uint8ArrayToString(body)) } catch { return undefined } } export const rpcDeviceToDevice = (d: T.RPCGen.Device): Device => { const type = d.type switch (type) { case 'mobile': case 'desktop': case 'backup': return { deviceNumberOfType: d.deviceNumberOfType, id: T.Devices.stringToDeviceID(d.deviceID), name: d.name, type: type, } default: throw new Error('Invalid device type detected: ' + type) } }