plogger-sdk
Version:
Typescript based frontend logging library compatible with multiple transports and JS/TS frameworks
23 lines • 824 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.jsonStringifyRecursive = void 0;
var errorObj_1 = require("./logs/errorObj");
function jsonStringifyRecursive(obj) {
var cache = new Set();
return JSON.stringify(obj, function (_, value) {
if (typeof value === "object" && value !== null) {
if (cache.has(value)) {
// Circular reference found, discard key
// return "[Circular]";
}
// Store value in our collection
cache.add(value);
}
if ((0, errorObj_1.isError)(value)) {
return (0, errorObj_1.stringifyErrorObject)(value);
}
return value;
});
}
exports.jsonStringifyRecursive = jsonStringifyRecursive;
//# sourceMappingURL=helperMethods.js.map