-
Notifications
You must be signed in to change notification settings - Fork 629
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
Added EOL detect / format #289
Conversation
fs/eol.ts
Outdated
if (!_eol) { | ||
return content; | ||
} else if (_eol === eol) { | ||
return content; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn’t work if the file has mixed newlines, since detect
only looks at the first newline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was really wondering about this case (for detect). Is that really possible? And in this case, what would you do? Because the file is somehow invalid no? (fixing the mixed format)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay. LGTM
(You should probably have a test for what detect(Mixed) does but this is fine for now. Also I think this shouldn’t be in fs... I feel like we need a “encoding” directory or something.)
I'll add the detect mixed in a further PR and let's discuss about the encoding directory in this PR. |
As files may be used in a Linux env but may come from a windows env, EOL is not the same. Added a FS helper for the detection / format. ATM it gets a string input, maybe coupled with readFileStr ( #276 ) in the future?