MCPcopy
hub / github.com/prisma/prisma / safeStringify

Function safeStringify

packages/debug/src/index.ts:136–156  ·  view source on GitHub ↗
(value: any, indent = 2)

Source from the content-addressed store, hash-verified

134}) as typeof debugCreate & typeof topProps
135
136function safeStringify(value: any, indent = 2) {
137 const cache = new Set<any>()
138
139 return JSON.stringify(
140 value,
141 (key, value) => {
142 if (typeof value === 'object' && value !== null) {
143 if (cache.has(value)) {
144 return `[Circular *]`
145 }
146
147 cache.add(value)
148 } else if (typeof value === 'bigint') {
149 return value.toString()
150 }
151
152 return value
153 },
154 indent,
155 )
156}
157
158/**
159 * We can get the logs for all the last {@link MAX_ARGS_HISTORY} ${@link debugCall} that

Callers 1

debugCallFunction · 0.85

Calls 3

hasMethod · 0.80
addMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected