From 46f509c661a121e38c8d6c82ff6be1a4749a1dba Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Wed, 8 Sep 2021 09:18:17 +0200 Subject: [PATCH] Use a higher depth and edge limit to avoid breaking people (#58) --- index.js | 4 ++-- readme.md | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 921314f..ecf7e51 100644 --- a/index.js +++ b/index.js @@ -11,8 +11,8 @@ var replacerStack = [] function defaultOptions () { return { - depthLimit: 10, - edgesLimit: 20 + depthLimit: Number.MAX_SAFE_INTEGER, + edgesLimit: Number.MAX_SAFE_INTEGER } } diff --git a/readme.md b/readme.md index fa6efa1..47179c9 100644 --- a/readme.md +++ b/readme.md @@ -35,9 +35,10 @@ function replacer(key, value) { } // those are also defaults limits when no options object is passed into safeStringify +// configure it to lower the limit. const options = { - depthLimit: 10, - edgesLimit: 20, + depthLimit: Number.MAX_SAFE_INTEGER, + edgesLimit: Number.MAX_SAFE_INTEGER }; const serialized = safeStringify(o, replacer, 2, options) @@ -166,4 +167,4 @@ MIT [`space`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The%20space%20argument [`toJSON`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#toJSON()_behavior [benchmark]: https://github.com/epoberezkin/fast-json-stable-stringify/blob/67f688f7441010cfef91a6147280cc501701e83b/benchmark -[JSON.stringify]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify \ No newline at end of file +[JSON.stringify]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify