MCPcopy
hub / github.com/vuejs/devtools-v6 / stringifyCircularAutoChunks

Function stringifyCircularAutoChunks

packages/shared-utils/src/transfer.ts:82–101  ·  view source on GitHub ↗
(data: any, replacer: (this: any, key: string, value: any) => any = null, space: number = null)

Source from the content-addressed store, hash-verified

80}
81
82export function stringifyCircularAutoChunks(data: any, replacer: (this: any, key: string, value: any) => any = null, space: number = null) {
83 let result
84 try {
85 result = arguments.length === 1
86 ? JSON.stringify(data)
87 : JSON.stringify(data, replacer, space)
88 }
89 catch (e) {
90 result = stringifyStrictCircularAutoChunks(data, replacer, space)
91 }
92 if (result.length > MAX_SERIALIZED_SIZE) {
93 const chunkCount = Math.ceil(result.length / MAX_SERIALIZED_SIZE)
94 const chunks = []
95 for (let i = 0; i < chunkCount; i++) {
96 chunks.push(result.slice(i * MAX_SERIALIZED_SIZE, (i + 1) * MAX_SERIALIZED_SIZE))
97 }
98 return chunks
99 }
100 return result
101}
102
103export function parseCircularAutoChunks(data: any, reviver: (this: any, key: string, value: any) => any = null) {
104 if (Array.isArray(data)) {

Callers 1

stringifyFunction · 0.90

Calls 1

Tested by

no test coverage detected