1.0.7 • Published 3 years ago

@yehonadav/safestringify v1.0.7

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 years ago

safeStringify

Replace JSON.stringify with safeStringify to stringify circular objects.
safely stringify objects to json format
and discard duplicate references to prevent loops

install

npm i @yehonadav/safestringify

usage

import {safeStringify} from "safestringify"

const a = {};
a.a = a;
a.b = 'b';

console.log(safeStringify(a));
// result:
// {
//   "b": "b"
// }

enjoy =)