normalize-newline
TypeScript icon, indicating that this package has built-in type declarations

4.1.0 • Public • Published

normalize-newline

Normalize the newline characters in a string to \n

Install

$ npm install normalize-newline

Usage

import normalizeNewline from 'normalize-newline';

normalizeNewline('foo\r\nbar\nbaz');
//=> 'foo\nbar\nbaz'

normalizeNewline(Buffer.from('foo\r\nbar\nbaz')).toString();
//=> 'foo\nbar\nbaz'

API

normalizeNewline(input)

input

Type: string | Buffer

Input to normalize.

Related

Package Sidebar

Install

npm i normalize-newline

Weekly Downloads

46,432

Version

4.1.0

License

MIT

Unpacked Size

3.34 kB

Total Files

5

Last publish

Collaborators

  • sindresorhus