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

event-stream

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

event-stream - npm Package Compare versions

Comparing version 0.8.2 to 0.9.0

34

index.js

@@ -32,3 +32,35 @@ //filter will reemit the data if cb(err,pass) pass is truthy

// buffered
//
// same as a through stream, but won't emit a chunk until the next tick.
// does not support any pausing. intended for testing purposes.
es.asyncThrough = function () {
var stream = new Stream()
var queue = []
var ended = false
bLen = bLen == null ? -1 : bLen //default to -1, infinite buffer.
stream.readable = stream.writable = true
stream.flush = function () {
while(queue.length)
stream.emit('data', queue.shift())
if(ended) stream.emit('end')
}
stream.write = function (data) {
if(ended) return
if(!queue.length)
process.nextTick(stream.flush)
queue.push(data)
return true
}
stream.end = function (data) {
if(data) stream.write(data)
ended = true
if(!queue.length)
stream.emit('end')
}
return stream
}
// writable stream, collects all events into an array

@@ -158,2 +190,3 @@ // and calls back when 'end' occurs

, inNext = false
//pipe only allows one argument. so, do not
function next (err) {

@@ -168,3 +201,2 @@ inNext = true

args.shift() //drop err
if (args.length){

@@ -171,0 +203,0 @@ args.unshift('data')

2

package.json
{ "name": "event-stream"
, "version": "0.8.2"
, "version": "0.9.0"
, "description": "construct pipes of streams of events"

@@ -4,0 +4,0 @@ , "homepage": "http://github.com/dominictarr/event-stream"

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