Skip to content

Instantly share code, notes, and snippets.

@0ct0d4n
Created December 12, 2018 15:26
Show Gist options
  • Select an option

  • Save 0ct0d4n/e91e8f6a96f430027f4e0ea3b07143c7 to your computer and use it in GitHub Desktop.

Select an option

Save 0ct0d4n/e91e8f6a96f430027f4e0ea3b07143c7 to your computer and use it in GitHub Desktop.
Detect and return OS specific line ending.
/**
* Detect and return OS specific line ending.
*
* @returns {String}
*/
function detectLineEnding() {
if ( os.platform() === 'win32' )
return '\r\n';
if ( os.platform() === 'darwin' )
return '\r';
return '\n';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment