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

Function encodeIfJson

docs/pseudo.esm.sh/tinybase@9.0.0/index.js:989–989  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

987var isCellOrValueOrUndefined = (cellOrValue) => isUndefined(cellOrValue) || !isUndefined(getCellOrValueType(cellOrValue));
988var isJsonType = (type) => type == OBJECT || type == ARRAY;
989var encodeIfJson = (value) => isObject(value) || isArray(value) ? JSON_PREFIX + jsonString(value) : value;
990var isEncodedJson = (value) => isString(value) && value[0] == JSON_PREFIX;
991var decodeIfJson = (raw, _id, encoded) => !encoded && isEncodedJson(raw) ? jsonParse(slice(raw, 1)) : raw;
992var stampClone = ([value, hlc]) => stampNew(value, hlc);

Callers 3

getValidatedCellFunction · 0.70
getValidatedValueFunction · 0.70

Calls 2

isObjectFunction · 0.70
isArrayFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…