MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / safeStringify

Function safeStringify

lib/utils.js:664–671  ·  view source on GitHub ↗
(obj, keysToSkip = [], space = 0)

Source from the content-addressed store, hash-verified

662 * @returns {string} JSON string representation
663 */
664export 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.

Callers 3

captureLogFunction · 0.90
mcp-server.jsFile · 0.90

Calls 1

Tested by

no test coverage detected