split-lines

2018-10-11 admin

split-lines是什么

什么是split-lines,Split lines into an array of lines

split-lines使用教程帮助文档

split-lines Build Status

Split lines into an array of lines

Install

$ npm install 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

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.

License

MIT © Sindre Sorhus

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-42438.html

文章标题:split-lines

回到顶部