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

promise-stream-queue

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

promise-stream-queue - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

examples/async.js

0

item.js

@@ -0,0 +0,0 @@ function Item(id,pr,timeout) {

49

main.js

@@ -90,49 +90,2 @@ const

if(!module.parent) {
const readline = require('readline');
var stream = new Stream(5000);
var nums = [];
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
if(process.argv[2]=="sync") {
stream.forEachSync((err,data,errcatch,next)=>{
if(errcatch) console.log("RESULT => Catch\t",err);
else if(err) console.log("RESULT => Reject\t",err);
else console.log("RESULT => Resolve\t",data);
rl.question('Next? <yes> / no : ', (answer) => {
if(!answer||answer=="next") next();
else process.exit(0);
});
});
}
else {
stream.forEach((err,data,errcatch)=>{
if(errcatch) console.log("RESULT => Catch\t",err);
else if(err) console.log("RESULT => Reject\t",err);
else console.log("RESULT => Resolve\t",data);
});
}
for(var i=0;i<100;i++) nums.push(i);
nums.forEach(i=>{
stream.push(new Promise((resolve,reject)=>{
var rnd = Math.random();
var to = Math.floor(Math.random()*10000);
var data = "PR => "+i+", "+to;
console.log(data);
setTimeout(()=>{
if(rnd<=0.5) {resolve(data);}
else {reject(data);}
},to);
}));
});
}
else {
module.exports = Stream;
}
module.exports = Stream;
{
"name": "promise-stream-queue",
"version": "0.1.0",
"version": "0.2.0",
"description": "Promise Stream. Queue promises and retrieve the resolved/rejected ones in the inserted order",

@@ -5,0 +5,0 @@ "author": "David Gómez Matarrodona <solzimer@gmail.com>",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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