0.1.1 • Published 5 years ago
split-stream-lines-preserve-eol-pmb v0.1.1
split-stream-lines-preserve-eol-pmb
Split a stream into lines that include their line terminator if they had one.
API
This module exports one function:
makeLineSplitter(opt)
Returns a duplex stream that splits the input by lines.
opt is an optional options object that supports these keys:
sep: RegExp for what you consider a line terminator. Default:/(\n)/nEolGroups: The number of match groups insep. Default:1discardRemainder: Boolean, whether to silently discard the last line if it was not properly terminated. Default:false
These experimental options are planned but do not work reliably yet:
throughOpt: Options to pass through tothrough2. Default: empty object.obj: A shortcut for enablingobjectModeinthroughOpt. Boolean. Default:falsecombine: A function that merges the line with the match group(s) of its terminator. It will be called with one argument, a flat array of all these parts. Can also befalseto pass on said array, auto-enabling theobjoption. Defaults to a function that can concat either buffers and strings.
Known issues
- Needs more/better tests and docs.
License
ISC