(obj, keysToSkip = [], space = 0)
| 662 | * @returns {string} JSON string representation |
| 663 | */ |
| 664 | export const safeStringify = function (obj, keysToSkip = [], space = 0) { |
| 665 | try { |
| 666 | return JSON.stringify(obj, createCircularSafeReplacer(keysToSkip), space) |
| 667 | } catch (error) { |
| 668 | // Fallback for any remaining edge cases |
| 669 | return JSON.stringify({ error: `Failed to serialize: ${error.message}` }, null, space) |
| 670 | } |
| 671 | } |
| 672 | |
| 673 | /** |
| 674 | * Truncate a string at a byte cap, returning structured info. |
no test coverage detected