Socket
Socket
Sign inDemoInstall

callback-sequence

Package Overview
Dependencies
6
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.1 to 1.3.0

changelog.md

8

index.js

@@ -24,4 +24,4 @@ var bindAsync = require('run-callback').bindAsync;

(function NEXT(i, len) {
if (i >= len) {
(function NEXT(i) {
if (i >= things.length) {
return done(null, res);

@@ -34,5 +34,5 @@ }

res.push(r);
NEXT(++i, len);
NEXT(++i);
});
}(0, things.length));
}(0));
}

@@ -39,0 +39,0 @@

{
"name": "callback-sequence",
"version": "1.2.1",
"version": "1.3.0",
"description": "Make a new callback to run input callbacks in sequence",

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

@@ -7,2 +7,3 @@ # callback-sequence

# Usage
[![npm](https://nodei.co/npm/callback-sequence.png)](https://www.npmjs.com/package/callback-sequence)

@@ -115,2 +116,25 @@ ```javascript

Actually, you can dynamically add callbacks:
```javascript
var sequence = require('callback-sequence');
var tasks = [task];
var count = 0;
function task(next) {
process.nextTick(function () {
count++;
if (count < 5) {
tasks.push(task);
}
next(null, count);
});
}
sequence.run(tasks, function (err, res) {
console.log(res);
// [ 1, 2, 3, 4, 5 ]
});
```
## results

@@ -132,1 +156,3 @@

# [Changelog](changelog.md)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc