@cjser/split-lines
v3.0.0-cjser.2
Published
Split lines into an array of lines
Downloads
72
Maintainers
Readme
split-lines
Split lines into an array of lines
Install
$ npm install split-linesUsage
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.
cjser
This package is a CommonJS-compatible build generated by cjser for projects that still need require() support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.
Original repository: https://github.com/sindresorhus/split-lines
