MCPcopy Index your code
hub / github.com/tinyplex/tinybase / decodeIfJson

Function decodeIfJson

src/common/cell.ts:70–79  ·  view source on GitHub ↗
(
  raw: CV,
  _id?: Id,
  encoded?: boolean,
)

Source from the content-addressed store, hash-verified

68 isString(value) && value[0] == JSON_PREFIX;
69
70export const decodeIfJson = <
71 CV extends Cell | Value | CellOrUndefined | ValueOrUndefined,
72>(
73 raw: CV,
74 _id?: Id,
75 encoded?: boolean,
76): CV =>
77 !encoded && isEncodedJson(raw)
78 ? (jsonParse(slice(raw, 1)) as AnyObject | AnyArray as CV)
79 : raw;
80
81export const getTypeCase = <
82 IfStringReturn,

Callers 13

getMergeableContentImplFunction · 0.90
getCellChangeFunction · 0.90
getValueChangeFunction · 0.90
getCellFunction · 0.90
getValueFunction · 0.90
forEachTableFunction · 0.90
forEachRowFunction · 0.90
forEachCellFunction · 0.90

Calls 2

sliceFunction · 0.90
isEncodedJsonFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…