MCPcopy
hub / github.com/codedogQBY/ReadAny / parseJSON

Function parseJSON

packages/core/src/db/db-core.ts:865–872  ·  view source on GitHub ↗
(str: string | null | undefined, fallback: T)

Source from the content-addressed store, hash-verified

863
864/** Shared JSON parser */
865export function parseJSON<T>(str: string | null | undefined, fallback: T): T {
866 if (!str) return fallback;
867 try {
868 return JSON.parse(str) as T;
869 } catch {
870 return fallback;
871 }
872}
873
874/** Serialize float32 embedding array to bytes */
875export function serializeEmbedding(embedding?: number[]): Uint8Array | null {

Callers 6

getNotesFunction · 0.90
getAllNotesFunction · 0.90
getSkillsFunction · 0.90
rowToBookFunction · 0.90
getMessagesFunction · 0.90
db-core.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected