lines-iterator
v0.2.0
Published
Iterates over lines, es6 way.
Downloads
2
Readme
Lines Iterator
Iterates over lines, es6 way.
lines-iterator allows you to iterate over lines via a es6
iterator.
Install
npm install --save lines-iterator
Usage
const lines = require('lines-iterator')
for (let line of lines('first\nsecond')) {
console.log(`LINE: ${line}`)
}
// => LINE: first
// => LINE: second
API
lines(text[, options])
text
{string}
Text containing eol
characters.
options
{object}
ignoreEmpty
{boolean}
Ignore empty lines.
const text = `
first
second
`
for (let line of lines(text, { ignoreEmpty: true })) {
console.log(`LINE: ${lines}`)
}
// => LINE: first
// => LINE: second
License
MIT © Nicolas Gryman