merge-stream
Advanced tools
Comparing version 0.1.8 to 1.0.0
'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 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2430
1
50
1
+ Addedreadable-stream@^2.0.1
+ Addedisarray@1.0.0(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
- Removedthrough2@^0.6.1
- Removedisarray@0.0.1(transitive)
- Removedreadable-stream@1.0.34(transitive)
- Removedstring_decoder@0.10.31(transitive)
- Removedthrough2@0.6.5(transitive)
- Removedxtend@4.0.2(transitive)