MCPcopy
hub / github.com/CodebuffAI/codebuff / safeStringify

Function safeStringify

cli/src/utils/logger.ts:49–60  ·  view source on GitHub ↗

* Safely stringify an object, handling circular references. * Replaces circular references with '[Circular]' placeholder.

(obj: unknown)

Source from the content-addressed store, hash-verified

47 * Replaces circular references with '[Circular]' placeholder.
48 */
49function safeStringify(obj: unknown): string {
50 const seen = new WeakSet()
51 return JSON.stringify(obj, (_key, value) => {
52 if (typeof value === 'object' && value !== null) {
53 if (seen.has(value)) {
54 return '[Circular]'
55 }
56 seen.add(value)
57 }
58 return value
59 })
60}
61
62function isEmptyObject(value: any): boolean {
63 return (

Callers 1

sendAnalyticsAndLogFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected