| 134 | }) as typeof debugCreate & typeof topProps |
| 135 | |
| 136 | function 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 |