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.3.0 to 2.4.0

test/group.js

7

docs/sources.md

@@ -15,7 +15,10 @@ # Sources

## readArray (array)
## values (array | object)
create a SourceStream that from an array and then stops.
create a SourceStream that reads the values from an array or object and then stops.
## keys (array | object)
stream the key names from an object (or array)
## count (max)

@@ -22,0 +25,0 @@

@@ -60,2 +60,9 @@ # Throughs

## group (len)
chunk incoming data into arrays of max length `len`,
(the last item may be shorter than len)
Useful for items you can handle in batches.
## highWaterMark (n)

@@ -62,0 +69,0 @@

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

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

@@ -22,3 +22,4 @@

var count = function (max) {
var count = exports.count =
function (max) {
var i = 0; max = max || Infinity

@@ -25,0 +26,0 @@ return function (end, cb) {

@@ -96,2 +96,31 @@ function prop (map) {

var group = exports.group =
function (read, size) {
var ended; size = size || 5
var queue = []
return function (end, cb) {
//this means that the upstream is sending an error.
if(end) return read(ended = end, cb)
//this means that we read an end before.
if(ended) return cb(ended)
read(null, function next(end, data) {
if(ended = ended || end) {
if(!queue.length)
return cb(ended)
var _queue = queue; queue = []
return cb(null, _queue)
}
queue.push(data)
if(queue.length < size)
return read(null, next)
var _queue = queue; queue = []
cb(null, _queue)
})
}
}
var nextTick = process.nextTick

@@ -98,0 +127,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