Socket
Socket
Sign inDemoInstall

split-stream-lines-preserve-eol-pmb

Package Overview
Dependencies
17
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    split-stream-lines-preserve-eol-pmb

Split a stream into lines that include their line terminator if they had one.


Version published
Weekly downloads
356
decreased by-34.32%
Maintainers
1
Install size
305 kB
Created
Weekly downloads
 

Readme

Source

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 in sep. Default: 1
  • discardRemainder: 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 to through2. Default: empty object.
  • obj: A shortcut for enabling objectMode in throughOpt. Boolean. Default: false
  • combine: 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 be false to pass on said array, auto-enabling the obj option. Defaults to a function that can concat either buffers and strings.

Known issues

  • Needs more/better tests and docs.

 

License

ISC

Keywords

FAQs

Last updated on 04 Jul 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc