plogger-sdk
Version:
Typescript based frontend logging library compatible with multiple transports and JS/TS frameworks
19 lines • 644 B
JavaScript
import { isError, stringifyErrorObject } from "./logs/errorObj";
export 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 (isError(value)) {
return stringifyErrorObject(value);
}
return value;
});
}
//# sourceMappingURL=helperMethods.js.map