MCPcopy Create free account
hub / github.com/AlexErrant/Pentive / encodeValue

Function encodeValue

app/src/sqlite/settings.ts:131–135  ·  view source on GitHub ↗
(rawValue: SettingValue)

Source from the content-addressed store, hash-verified

129const encoder = new TextEncoder() // always utf-8
130const decoder = new TextDecoder('utf-8')
131export function encodeValue(rawValue: SettingValue) {
132 return Array.isArray(rawValue) || typeof rawValue === 'boolean'
133 ? encoder.encode(JSON.stringify(rawValue))
134 : rawValue
135}
136function decodeValue(value: Uint8Array<ArrayBuffer>) {
137 return JSON.parse(decoder.decode(value)) as SettingValue
138}

Callers 1

bulkUploadSettingsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected