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.2 to 2.11.0

test/find.js

16

docs/sinks.md

@@ -16,4 +16,14 @@

## writeArray(cb)
## drain (op?, done?)
Drain the stream, calling `op` on each `data`.
call `done` when stream is finished.
If op returns `===false`, abort the stream.
## reduce (reduce, initial, cb)
reduce stream into single value, then callback.
## collect(cb)
Read the stream into an array, then callback.

@@ -25,6 +35,2 @@

## drain (op?)
Drain the stream, calling `op` on each `data`.
## log

@@ -31,0 +37,0 @@

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

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

@@ -14,4 +14,9 @@ var drain = exports.drain = function (read, op, done) {

op && op(data)
if(op) {
//return false to abort!
if(false === op(data)) {
loop = false
read(true, done || function () {})
}
}
if(!sync) next()

@@ -25,2 +30,17 @@ })

var find =
exports.find = function (read, test, cb) {
var ended = false
drain(read, function (data) {
if(test(data)) {
ended = true
cb(null, data)
return false
}
}, function (err) {
if(ended) return //already called back
cb(err === true ? null : err, null)
})
}
var reduce = exports.reduce =

@@ -27,0 +47,0 @@ function (read, reduce, acc, cb) {

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