-
Notifications
You must be signed in to change notification settings - Fork 342
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
allow overriding the EOL string #89
Conversation
I just thought of something... does the JSON standard specify an EOL? Or does it state it should be platform specific? |
I'm not sure, but I think once you start involving the file-system, it is your court to format it as you please? Maybe I'm wrong. I doubt there's a bug in JSON.stringify, so they are probably correctly forcing '\n'. I don't necessarily like that, but it is probably correct to spec. |
The json spec doesn't define any newlines; matter of fact, it doesn't define any formatting; JSON formatting is simply a convention. Here's all the spec has to say:
The EcmaScript spec defines that it shall be a linefeed. I think we should keep this the default; users can override if they wish. |
One thing I wonder about; is it wise to have this as a global setting on |
I could go either way. |
Is this OK to merge, or should I change the global option? |
dd4927a
to
c576670
Compare
Let's remove the global. |
Global removed |
Thanks @kellyselden! |
Closes #87.
I decided to make it an optional setting as to not cause any grief to anyone. We can always change the default to from
'\n'
torequire('os').EOL
in the future if we want to do a major version bump if we consider it a breaking change.