Package Exports
- circular
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (circular) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Circular
Tiny utility to safely stringify objects with circular references.
Usage
Replace all circular references with the string [Circular]
;
var circular = require('circular');
var obj = {}; var child = {parent: obj}; obj.child = child;
var str = JSON.stringify(obj, circular());
// => {"child":{"parent":"[Circular]"}}
If you prefer you can pass an alternative string to use:
var str = JSON.stringify(obj, circular('#ref'));
Or a function that returns a string:
function ref(value){return '' + value};
var str = JSON.stringify(obj, circular(ref));