JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 223359
  • Score
    100M100P100Q218457F
  • License MIT

Split lines into an array of lines

Package Exports

  • split-lines

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (split-lines) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

split-lines Build Status

Split lines into an array of lines

Install

$ npm install --save split-lines

Usage

const splitLines = require('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(input, [options])

input

Type: string

String to split.

options

preserveNewlines

Type: boolean
Default: false

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

License

MIT © Sindre Sorhus