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

stream-collect

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stream-collect - npm Package Compare versions

Comparing version 1.2.1 to 1.3.0

11

index.js

@@ -114,3 +114,2 @@ /* jshint node: true */

stream.PassThrough.call( this, options );

@@ -144,4 +143,14 @@ addToStream(this);

/**
* A PassThrough set to objectMode
*/
function PassThroughObject(options) {
options = options || {};
options.objectMode = true;
return new PassThrough(options);
}
module.exports = collect;
collect.addToStream = addToStream;
collect.PassThrough = collect.stream = PassThrough;
collect.PassThroughObject = collect.objectStream = PassThroughObject;
{
"name": "stream-collect",
"version": "1.2.1",
"version": "1.3.0",
"description": "Collects the output of a stream as callback or promise",
"keywords": [
"stream",
"collect",
"promise"
],
"main": "index.js",

@@ -6,0 +11,0 @@ "scripts": {

@@ -75,3 +75,6 @@ # Stream collect

## `collect.objectStream()` / `collect.PassThroughObject()`
Returns a new `collect.stream` with `objectMode` set to true.
## collect.addToStream(stream)

@@ -78,0 +81,0 @@

@@ -244,3 +244,47 @@ /* jshint node: true, mocha: true */

describe( 'collect.PassThroughObject', function() {
it( 'creates a collect.PassThrough instance', function( ) {
expect( new collect.PassThroughObject() ).toBeA( collect.PassThrough );
} );
it( 'is a PassThrough stream', function( ) {
expect( new collect.PassThroughObject() ).toBeA( PassThrough );
} );
it( 'is can be instigated without new', function( ) {
expect( collect.PassThroughObject() ).toBeA( PassThrough );
} );
it( 'collect.objectStream is a collect.PassThroughStream', function( ) {
expect( collect.objectStream ).toBe( collect.PassThroughObject );
} );
it( 'creates a PassThrough instance with objectMode on', function( ) {
var objectStream = collect.objectStream();
expect( objectStream._readableState.objectMode ).toBe( true );
expect( objectStream._writableState.objectMode ).toBe( true );
} );
it( 'collects as an object stream', function() {
var stream = new collect.PassThrough( {objectMode: true });
var ob1 = {};
var ob2 = {};
stream.write( ob1 );
stream.end( ob2 );
return stream.pipe( collect.objectStream() )
.then( function(data) {
expect( data[0] ).toBe(ob1);
expect( data[1] ).toBe(ob2);
} );
} );
} );
describe( 'collect', function() {

@@ -247,0 +291,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