package
Split lines into an array of lines
npm install split-linesGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 1 packages.
3.5 kB
Includes dependencies.
Split lines into an array of lines
$ npm install split-linesimport 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']Type: string
String to split.
Type: object
Type: boolean
Default: false
Preserve the line separator at the end of every line, except the last line, which will never contain one.