Normalize the newline characters in a string to
\n
$ npm install normalize-newline
import normalizeNewline from 'normalize-newline';
normalizeNewline('foo\r\nbar\nbaz');
//=> 'foo\nbar\nbaz'
normalizeNewline(Buffer.from('foo\r\nbar\nbaz')).toString();
//=> 'foo\nbar\nbaz'
Type: string | Buffer
Input to normalize.
- normalize-newline-cli - CLI for this module