New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

enque

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enque - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

2

package.json
{
"name": "enque",
"version": "1.1.2",
"version": "1.1.3",
"description": "Run asynchonous functions in succession while potentially operating on the same data.",

@@ -5,0 +5,0 @@ "main": "enQue.js",

@@ -5,5 +5,5 @@ # enQue.js

```javascript
const enQue = new require('enQue')
const myQue = enQue([fn1, fn2, fn3, fn4, fn5])
myQue.run(data)
const enQue = new require('enQue');
const myQue = enQue([fn1, fn2, fn3, fn4, fn5]);
myQue.run(data);
```

@@ -31,5 +31,5 @@ For full documentation see the [enQue source code](https://ileathan.github.io/enQue).

```javascript
myQue.run()
.then(sucessCallback)
.catch(errorCallback)
myQue.run();
.then(sucessCallback);
.catch(errorCallback);
```

@@ -52,56 +52,56 @@

Que = require('enQue')
que = new Que()
Que = require('enQue');
que = new Que();
function fn1(data, next) {
console.log(1)
next()
console.log(1);
next();
}
function fn2(data, next) {
console.log(2)
next()
console.log(2);
next();
}
que.add(fn1)
que.run() // 1
que.clear()
que.add(fn1);
que.run(); // 1
que.clear();
que.add([fn1, fn1, fn1])
que.run() // 1 1 1
que.clear()
que.add([fn1, fn1, fn1]);
que.run(); // 1 1 1
que.clear();
que.fill(fn1, 7)
que.run()
que.clear() // 1 1 1 1 1 1 1
que.fill(fn1, 7);
que.run();
que.clear(); // 1 1 1 1 1 1 1
que.add([fn1, fn1, fn1])
que.remove(fn1)
que.run() // ""
que.add([fn1, fn1, fn1]);
que.remove(fn1);
que.run(); // ""
que.add([fn1, fn2, fn2, fn2])
que.remove([fn1, fn2], 3) // for best preformance only pass in numbers i.e. `remove(0); remove(1); remove(2)`
que.run() // 2
que.clear()
que.add([fn1, fn2, fn2, fn2]);
que.remove([fn1, fn2], 3); // for best preformance only pass in numbers i.e. `remove(0); remove(1); remove(2)`
que.run(); // 2
que.clear();
que.add([(d,n)=>n(5), fn1, fn1, fn1, fn1, fn1, fn1])
que.run() // 1
que.clear()
que.add([(d,n)=>n(5), fn1, fn1, fn1, fn1, fn1, fn1]);
que.run(); // 1
que.clear();
que.add([(d,n)=>n({quit:3}), fn1, fn1, fn1, fn2, fn2, fn2])
que.run() // 1 1 1
que.clear()
que.add([(d,n)=>n({quit:3}), fn1, fn1, fn1, fn2, fn2, fn2]);
que.run(); // 1 1 1
que.clear();
que.add((d,n,i)=>{console.log("hi"); n()})
que.remove('(d,n,i)=>{console.log("hi"); n()}')
que.run() // ""
que.add((d,n,i)=>{console.log("hi"); n()});
que.remove('(d,n,i)=>{console.log("hi"); n()}');
que.run(); // ""
fn5 = (data, next, index, done) => {
console.log(index)
index === 2 ? next(0) : next()
console.log(index);
index === 2 ? next(0) : next();
// instead of next(0) you can use done()
}
que.add([fn5, fn5, fn5, fn5, fn5])
que.run() // 0 1 2
que.clear()
que.add([fn5, fn5, fn5, fn5, fn5]);
que.run(); // 0 1 2
que.clear();

@@ -113,6 +113,15 @@ fn3 = (data, next) => {

que.add([(d,n)=>n({inject:5, function: function(d){d.data="7"}}), fn3, fn3, fn3, fn3, fn3])
que.run().then(res=>console.log(res)) // d.data === 7
que.add([(d,n)=>n({inject:5, function: function(d){d.data="7"}}), fn3, fn3, fn3, fn3, fn3]);
que.run().then(res=>console.log(res)); // d.data === 7
// To initialise the date use `run(data)` where data is an Object.
que.clear()
que.clear();
function fn6(data, next, index) {
throw new Error("Woopsie!");
next();
}
que.add([fn6, fn6, fn6, fn6, fn6]);
que.run().catch(e=>console.log(e)); // prints the thrown error.
```

@@ -143,2 +152,8 @@

{ data: '7' }
Error: Woopsie!
at fn6 (...)
at options (...)
at enQue.executeQue (...)
at ...
...
```

@@ -145,0 +160,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