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

Line separator should be considered to use os.EOL when AppendLine #21

Open
NewGyu opened this issue Dec 31, 2020 · 2 comments
Open

Line separator should be considered to use os.EOL when AppendLine #21

NewGyu opened this issue Dec 31, 2020 · 2 comments

Comments

@NewGyu
Copy link

NewGyu commented Dec 31, 2020

Current implementation is the following.

    public AppendLine(value: string) {
        this.Values.push('\r\n' + value);
    }

On Windows, the line separator \r\n is correct, but it is not correct separator on Linux/Mac. Could you consider to use os.EOL?

https://nodejs.org/api/os.html#os_os_eol

@aequi42
Copy link
Collaborator

aequi42 commented Jan 25, 2021

Mhm, I think this wouldn`t work for browser enviroments.

Maybe something like this would match your requirement, but work in both environments?
https://github.com/p2227/universal-eol/blob/master/eol.js?

@NewGyu
Copy link
Author

NewGyu commented Jan 26, 2021

Sorry for lack of information about my usecase. I used this npm for command line tool which is run on node.js. I didn't thik about the case running on Browser. I'm not familiar with Browser JS, but I explore some library implementation. The following implementation seems similar to the example you've mentioned. Thank you.

https://github.com/ryanve/eol/blob/e89fda4a2480d03cddd5274f787313f15c6cb73c/eol.js#L7

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

2 participants