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

object-stream-tools

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-stream-tools - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

test/data.json

37

index.js

@@ -0,1 +1,3 @@

'use strict';
const stream = require('stream');

@@ -5,16 +7,17 @@ const through2Concurrent = require('through2-concurrent');

'use strict';
function thru(transform, flush) {
return new stream.Transform({
objectMode: true,
transform: (obj, enc, cb) => transform(obj, cb),
flush
});
}
const thru = (transform, flush) => new stream.Transform({
objectMode: true,
transform,
flush
});
function thruParallel(maxConcurrency, transform, flush) {
return through2Concurrent.obj({ maxConcurrency },
(obj, enc, cb) => transform(obj, cb), flush
);
}
const thruParallel = (transform, maxConcurrency) =>
thruConcurrent.obj({ maxConcurrency }, transform);
const devNull = require('fs').createWriteStream('/dev/null');
const arrayToStream = (data) => {
function arrayToStream(data) {
const newStream = new stream.Readable({ objectMode: true });

@@ -26,3 +29,3 @@ data.forEach(item => newStream.push(item));

const streamToSet = (stream) => {
function streamToSet(stream) {
return new Promise((resolve, reject) => {

@@ -37,3 +40,3 @@ const set = new Set();

const newReadable = () => {
function newReadable() {
const rs = new stream.Readable({ objectMode: true });

@@ -66,10 +69,4 @@ rs._read = () => {};

};
module.exports = {
thru,
Stream,
devNull,
thruConcurrent,
thruParallel,

@@ -76,0 +73,0 @@ arrayToStream,

{
"name": "object-stream-tools",
"version": "1.0.0",
"version": "1.1.0",
"description": "Useful tools for manipulating object streams. Will be especially helpful to developers used to map - filter - reduce approach of nodejs arrays.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "node_modules/tap/bin/run.js test/test.js"
},

@@ -30,3 +30,11 @@ "repository": {

},
"homepage": "https://github.com/kichooo/object-stream-tools#readme"
"homepage": "https://github.com/kichooo/object-stream-tools#readme",
"devDependencies": {
"JSONStream": "^1.1.1",
"tap": "^5.7.2"
},
"dependencies": {
"stream-to-array": "^2.3.0",
"through2-concurrent": "^1.1.1"
}
}
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