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

pull-stream

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pull-stream - npm Package Compare versions

Comparing version 2.10.1 to 2.10.2

2

package.json
{
"name": "pull-stream",
"description": "minimal pull stream",
"version": "2.10.1",
"version": "2.10.2",
"homepage": "https://github.com/dominictarr/pull-stream",

@@ -6,0 +6,0 @@ "repository": {

@@ -0,8 +1,30 @@

var drain = exports.drain = function (read, op, done) {
;(function next() {
var sync = true, returned = false, loop = true
do {
returned = false; sync = true
read(null, function (err, data) {
returned = true
if(err) {
done && done(err === true ? null : err)
return loop = false
}
op && op(data)
if(!sync) next()
})
sync = false
if(!returned) return
} while (loop);
})()
}
var reduce = exports.reduce =
function (read, reduce, acc, cb) {
read(null, function next (end, data) {
if(end) return cb(end === true ? null : end, acc)
drain(read, function (data) {
acc = reduce(acc, data)
read(null, next)
}, function (err) {
cb(err, acc)
})

@@ -19,18 +41,9 @@ }

//if the source callsback sync, then loop
//rather than recurse
var onEnd = exports.onEnd = function (read, done) {
return read(null, function next (err, data) {
if(err) return done(err === true ? null : err)
read(null, next)
})
return drain(read, null, done)
}
var drain = exports.drain = function (read, op, done) {
return read(null, function next (err, data) {
if(err) return done && done(err === true ? null : err)
op && op(data)
read(null, next)
})
}
var log = exports.log = function (read, done) {

@@ -37,0 +50,0 @@ return drain(read, console.log.bind(console), done)

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