Skip to content

Instantly share code, notes, and snippets.

@DanyelMorales
Created December 12, 2018 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanyelMorales/7d949d9a67724c5443fa957f955db9ea to your computer and use it in GitHub Desktop.
Save DanyelMorales/7d949d9a67724c5443fa957f955db9ea 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