MCPcopy
hub / github.com/tinyplex/tinybase / encodeIfJson

Function encodeIfJson

src/common/cell.ts:62–65  ·  view source on GitHub ↗
(value: CV)

Source from the content-addressed store, hash-verified

60 type == OBJECT || type == ARRAY;
61
62export const encodeIfJson = <CV extends Cell | Value>(value: CV): CV =>
63 isObject(value) || isArray(value)
64 ? ((JSON_PREFIX + jsonString(value)) as CV)
65 : value;
66
67export const isEncodedJson = (value: any): value is string =>
68 isString(value) && value[0] == JSON_PREFIX;

Callers 3

getValidatedCellFunction · 0.90
getValidatedValueFunction · 0.90

Calls 2

isObjectFunction · 0.90
isArrayFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…