normalize-newline
Normalize the newline characters in a string to `\n`
Last updated 4 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install normalize-newline 
SYNC missed versions from official npm registry.

normalize-newline Build Status

Normalize the newline characters in a string to \n

Install

$ npm install --save normalize-newline

Usage

const normalizeNewline = require('normalize-newline');

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

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

API

normalizeNewline(input)

input

Type: string Buffer

Input to normalize.

Related

License

MIT © Sindre Sorhus

Current Tags

  • 3.0.0                                ...           latest (4 years ago)

7 Versions

  • 3.0.0                                ...           4 years ago
  • 2.1.0                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
  • 0.1.0                                ...           6 years ago

Copyright 2014 - 2016 © taobao.org |