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.28.1 to 2.28.2

2

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

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

@@ -84,1 +84,38 @@ var pull = require('../')

})
test("take doesn't abort until the last read", function (t) {
var aborted = false
var ary = [1,2,3,4,5], i = 0
var read = pull(
function (abort, cb) {
if(abort) cb(aborted = true)
else if(i > ary.length) cb(true)
else cb(null, ary[i++])
},
pull.take(function (d) {
return d < 3
}, {last: true})
)
read(null, function (_, d) {
t.notOk(aborted, "hasn't aborted yet")
read(null, function (_, d) {
t.notOk(aborted, "hasn't aborted yet")
read(null, function (_, d) {
t.notOk(aborted, "hasn't aborted yet")
read(null, function (end, d) {
t.ok(end, 'stream ended')
t.equal(d, undefined, 'data undefined')
t.ok(aborted, "has aborted by now")
t.end()
})
})
})
})
})

@@ -143,18 +143,25 @@ var u = require('pull-core')

return function (end, cb) {
if(ended) return cb(ended)
if(ended = end) return read(ended, cb)
read(null, function (end, data) {
if(ended = ended || end) return cb(ended)
if(!test(data)) {
ended = true
read(true, function () {
last ? cb(end, data) : cb(true)
})
}
else
cb(null, data)
function terminate (cb) {
read(true, function (err) {
last = false; cb(err || true)
})
}
return function (end, cb) {
if(ended) last ? terminate(cb) : cb(ended)
else if(ended = end) read(ended, cb)
else
read(null, function (end, data) {
if(ended = ended || end) {
//last ? terminate(cb) :
cb(ended)
}
else if(!test(data)) {
ended = true
last ? cb(null, data) : terminate(cb)
}
else
cb(null, data)
})
}
}

@@ -161,0 +168,0 @@

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