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.23.1 to 2.24.0

test/flat-map.js

2

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

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

@@ -90,7 +90,13 @@ var u = require('pull-core')

return function next (end, cb) {
read(end, function (end, data) {
if(!end && !test(data))
return next(end, cb)
cb(end, data)
})
var sync, loop = true
while(loop) {
loop = false
sync = true
read(end, function (end, data) {
if(!end && !test(data))
return sync ? loop = true : next(end, cb)
cb(end, data)
})
sync = false
}
}

@@ -300,3 +306,25 @@ }

var flatMap = exports.flatMap =
function (read, mapper) {
mapper = mapper || id
var queue = [], ended
return function (abort, cb) {
if(queue.length) return cb(null, queue.shift())
else if(ended) return cb(ended)
read(abort, function next (end, data) {
if(end) ended = end
else {
var add = mapper(data)
while(add && add.length)
queue.push(add.shift())
}
if(queue.length) cb(null, queue.shift())
else if(ended) cb(ended)
else read(null, next)
})
}
}
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