Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

merge-stream

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

merge-stream - npm Package Compare versions

Comparing version 0.1.8 to 1.0.0

4

index.js
'use strict';
var through = require('through2')
var PassThrough = require('readable-stream/passthrough')
module.exports = function (/*streams...*/) {
var sources = []
var output = through.obj()
var output = new PassThrough({objectMode: true})

@@ -9,0 +9,0 @@ output.setMaxListeners(0)

{
"name": "merge-stream",
"version": "0.1.8",
"version": "1.0.0",
"description": "Create a stream that emits events from multiple other streams",

@@ -16,8 +16,8 @@ "main": "index.js",

"dependencies": {
"through2": "^0.6.1"
"readable-stream": "^2.0.1"
},
"devDependencies": {
"from2": "^1.2.0",
"from2": "^2.0.3",
"istanbul": "^0.3.2"
}
}

@@ -17,2 +17,4 @@ # merge-stream

merged.add(stream3);
merged.isEmpty();
//=> false
```

@@ -22,6 +24,28 @@

This is the merge function from [event-stream](https://github.com/dominictarr/event-stream) separated into a new module and given an `add` method so you can dynamically add more sources to the stream.
This is adapted from [event-stream](https://github.com/dominictarr/event-stream) separated into a new module, using Streams3.
## API
`merged.add`
A method to dynamically add more sources to the stream.
`merged.isEmpty`
A method that tells you if the merged stream is empty.
When a stream is "empty" (aka. no sources were added), it could not be returned to a gulp task.
So, we could do something like this:
```js
stream = require('merge-stream')();
// Something like a loop to add some streams to the merge stream
// stream.add(streamA);
// stream.add(streamB);
return stream.isEmpty() ? null : stream;
```
## License
MIT
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc