split-lines
Split lines into an array of lines
Last updated 8 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install split-lines 
SYNC missed versions from official npm registry.

split-lines

Split lines into an array of lines

Install

$ npm install split-lines

Usage

import splitLines from 'split-lines';

splitLines('foo\r\nbar\r\nbaz\nrainbow');
//=> ['foo', 'bar', 'baz', 'rainbow']

splitLines('foo\r\nbar\r\nbaz\nrainbow', {preserveNewlines: true});
//=> ['foo\r\n', 'bar\r\n', 'baz\n', 'rainbow']

API

splitLines(string, options?)

string

Type: string

String to split.

options

Type: object

preserveNewlines

Type: boolean
Default: false

Preserve the line separator at the end of every line, except the last line, which will never contain one.

Current Tags

  • 3.0.0                                ...           latest (5 years ago)

6 Versions

  • 3.0.0                                ...           5 years ago
  • 2.1.0                                ...           5 years ago
  • 2.0.0                                ...           8 years ago
  • 1.1.0                                ...           10 years ago
  • 1.0.0                                ...           12 years ago
  • 0.1.0                                ...           12 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (2)
Dependents (3)

Copyright 2013 - present © cnpmjs.org | Home |