Closed wtgtybhertgeghgtwtg closed 5 years ago
The main use case for this package is to create the same string from the deep-equal objects to be used as a key - in this case the space option is NOT needed (and it only impacts performance).
If the object is stringified for the presentation the normal JSON can be used, can't it?
This was mostly raised for webpack
use, but they decided to go in another direction. Sorry for the bother.
I'd still be interested in this. It is correct that I want stable JSON for (test comparisons), but I also need them to be human-readable.
The main use case for this package is to create the same string from the deep-equal objects to be used as a key - in this case the space option is NOT needed (and it only impacts performance).
If the object is stringified for the presentation the normal JSON can be used, can't it?
@epoberezkin I’m not sure how representative this is, but my use case also requires space
. I dynamically create a large object from scraped content, and check it into source control. Diffs are huge if the saved JSON is a single line. They are usually a single line with a stable property order… but I need to pass in space
for that to work.
Same here, I stable stringify to see diffs in my tests. I don't want to look at one line JSON files.
One feature that is lost in the transition from
json-stable-stringify
tofast-json-stable-stringify
is the space option. It may be a performance hiccup, but including it would allow easier transition from projects that usejson-stable-stringify
.