UNPKG

@comake/skl-js-engine

Version:

Standard Knowledge Language Javascript Engine

19 lines 604 B
"use strict"; // // Preserve the native JSON.stringify // const nativeJSONStringify = JSON.stringify; // function stringifyCircular(obj: any) { // const seen = new WeakSet(); // return nativeJSONStringify(obj, (key, value) => { // if (value !== null && typeof value === 'object') { // if (seen.has(value)) { // // Circular reference found, discard key // return; // } // seen.add(value); // } // return value; // }); // } // global.JSON.stringify = stringifyCircular; // JSON.stringify = stringifyCircular; //# sourceMappingURL=safeJsonStringify.js.map