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

async-waterfall

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-waterfall - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

2

bower.json

@@ -5,3 +5,3 @@ {

"description": "Runs a list of async tasks, passing the results of each into the next one",
"version": "0.1.2",
"version": "0.1.3",
"keywords": ["async", "waterfall", "tasks", "control", "flow"],

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

@@ -5,3 +5,3 @@ {

"description": "Runs a list of async tasks, passing the results of each into the next one",
"version": "0.1.2",
"version": "0.1.3",
"keywords": ["async", "waterfall", "tasks", "control", "flow"],

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

@@ -30,6 +30,10 @@ // MIT license (by Elan Shanker).

};
var _isArray = Array.isArray || function(maybeArray){
return Object.prototype.toString.call(maybeArray) === "[object Array]";
};
var waterfall = function (tasks, callback) {
callback = callback || function () {};
if (tasks.constructor !== Array) {
if (!_isArray(tasks)) {
var err = new Error('First argument to waterfall must be an array of functions');

@@ -36,0 +40,0 @@ return callback(err);

{
"name": "async-waterfall",
"version": "0.1.2",
"version": "0.1.3",
"description": "Runs a list of async tasks, passing the results of each into the next one",

@@ -5,0 +5,0 @@ "author": {

@@ -30,6 +30,23 @@ # async-waterfall

#### Node.js:
##### Node.js:
```javascript
var waterfall = require('async-waterfall');
waterfall(tasks, callback);
```
##### Browser:
```javascript
// component(1)
var waterfall = require('async-waterfall');
waterfall(tasks, callback);
// Default:
window.asyncWaterfall(tasks, callback);
```
##### Tasks as Array of Functions
```javascript
waterfall([

@@ -51,13 +68,17 @@ function(callback){

#### Browser:
##### Derive Tasks from an Array.map
```javascript
// component(1)
var waterfall = require('async-waterfall');
waterfall(tasks, callback);
// Default:
window.asyncWaterfall(tasks, callback);
waterfall(myArray.map(function (arrayItem) {
return function (lastItemResult, nextCallback) {
// same execution for each item in the array
var itemResult = doThingsWith(arrayItem, lastItemResult);
// results carried along from each to the next
nextCallback(null, itemResult);
}}), function (err, result) {
// final callback
});
```
## Acknowledgements

@@ -64,0 +85,0 @@ Hat tip to [Caolan McMahon](https://github.com/caolan) and

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