typescript-string-operations
typescript-string-operations copied to clipboard
Line separator should be considered to use os.EOL when AppendLine
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
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?
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