Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider accepting a space option. #5

Closed
wtgtybhertgeghgtwtg opened this issue Jan 26, 2019 · 5 comments
Closed

Consider accepting a space option. #5

wtgtybhertgeghgtwtg opened this issue Jan 26, 2019 · 5 comments

Comments

@wtgtybhertgeghgtwtg
Copy link

One feature that is lost in the transition from json-stable-stringify to fast-json-stable-stringify is the space option. It may be a performance hiccup, but including it would allow easier transition from projects that use json-stable-stringify.

@epoberezkin
Copy link
Owner

epoberezkin commented Sep 10, 2019

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?

@wtgtybhertgeghgtwtg
Copy link
Author

This was mostly raised for webpack use, but they decided to go in another direction. Sorry for the bother.

@retorquere
Copy link

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.

@rileyjshaw
Copy link

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.

@i-am-the-slime
Copy link

Same here, I stable stringify to see diffs in my tests. I don't want to look at one line JSON files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants