MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / stableStringify

Function stableStringify

src/stores/aiChatChartBlocks.ts:147–156  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

145}
146
147function stableStringify(value: unknown): string {
148 if (Array.isArray(value)) return `[${value.map(stableStringify).join(',')}]`
149 if (isRecord(value)) {
150 return `{${Object.keys(value)
151 .sort()
152 .map((key) => `${JSON.stringify(key)}:${stableStringify(value[key])}`)
153 .join(',')}}`
154 }
155 return JSON.stringify(value)
156}
157
158function chartSignature(chart: ChartPayload): string {
159 const persisted = toPersistedChartPayload(chart)

Callers 1

chartSignatureFunction · 0.85

Calls 1

isRecordFunction · 0.70

Tested by

no test coverage detected