Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including normalize-newline with all npm packages installed. Try it out:

var normalizeNewline = require("normalize-newline")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

normalize-newline v3.0.0

Normalize the newline characters in a string to `\n`

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

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free