apr-waterfall
Advanced tools
Comparing version 1.0.1 to 1.0.2
25
index.js
const each = require('apr-engine-each'); | ||
/** | ||
* <a id="waterfall"></a> | ||
* Runs the `tasks` array of functions in series, each passing their results to the next in the array. | ||
* | ||
* [![](https://img.shields.io/npm/v/apr-waterfall.svg?style=flat-square)](https://www.npmjs.com/package/apr-waterfall) [![](https://img.shields.io/npm/l/apr-waterfall.svg?style=flat-square)](https://www.npmjs.com/package/apr-waterfall) | ||
* | ||
* @kind function | ||
* @name waterfall | ||
* @param {Array<Function>|Object} tasks | ||
* @param {Any} [initial] | ||
* @returns {Promise} | ||
* | ||
* @example | ||
* import waterfall from 'apr-waterfall'; | ||
* | ||
* const then = (v) => new Promise((resolve) => resolve(v)); | ||
* | ||
* const output = await waterfall([ | ||
* async () => await then(1), | ||
* async (v) => await then(v + 2), | ||
* async (v) => await then(v + 3) | ||
* ]); | ||
* | ||
* // output = 6 | ||
*/ | ||
module.exports = (input, initial) => { | ||
@@ -4,0 +29,0 @@ let last = initial; |
{ | ||
"name": "apr-waterfall", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"homepage": "https://github.com/ramitos/apr/tree/master/packages/waterfall", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
2705
3
43
1
32