MCPcopy Create free account
hub / github.com/simstudioai/sim / measureJson

Function measureJson

apps/sim/lib/execution/payloads/large-array-manifest.ts:38–49  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

36}
37
38function measureJson(value: unknown): { json: string; size: number } {
39 let json: string | undefined
40 try {
41 json = JSON.stringify(value)
42 } catch {
43 throw new Error(LARGE_ARRAY_MANIFEST_JSON_SERIALIZATION_ERROR)
44 }
45 if (json === undefined) {
46 throw new Error(LARGE_ARRAY_MANIFEST_JSON_SERIALIZATION_ERROR)
47 }
48 return { json, size: Buffer.byteLength(json, 'utf8') }
49}
50
51function assertArray(value: unknown): asserts value is unknown[] {
52 if (!Array.isArray(value)) {

Callers 3

getPreviewFunction · 0.70
storeArrayChunkFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected