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

Add option to override final EOL in file #137

Merged

Conversation

asingh04
Copy link
Contributor

Added a check for an option finalEOL.
If the finalEOL is absent in the options object, the EOL(\n) character will be appended at end of file while writing, in order to maintain backward compatibility.

If the finalEOL option has any falsey value, the EOL at the end of the file will be not be written.

Copy link
Collaborator

@RyanZim RyanZim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No point testing for truthy values other than true.

Also, this will need docs.

We also should probably use destructuring with default parameters in stringify to simplify the logic.

test/write-file-sync.test.js Outdated Show resolved Hide resolved
test/write-file.test.js Outdated Show resolved Hide resolved
@RyanZim RyanZim linked an issue Oct 17, 2020 that may be closed by this pull request
@asingh04
Copy link
Contributor Author

  1. Changes done in the test files
  2. Used object destructuring in the stringify function of utils file
  3. Updated the README file

Copy link
Collaborator

@RyanZim RyanZim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@RyanZim RyanZim merged commit 5187bf3 into jprichardson:master Oct 31, 2020
@asingh04 asingh04 deleted the Add-option-to-override-final-EOL-in-file branch November 1, 2020 01:31
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

Successfully merging this pull request may close these issues.

Add an option to write a final newline
2 participants