promisefall
v1.0.0
Published
give it a promise, array of arguments, and go back and watch the promise waterfall and get the array of result at the end of that!
Downloads
7
Maintainers
Readme
node-promisefall
Chains an promise with array of arguments that return result in type of array of promises
Installation
$ npm install promisefall
Usage
promiseFall(promiseFunction,arrayOfArguments);
- promiseFunction - A function that you want arguments to iterate on that in sequential order. NOTE: supports any promise library that has promises with a then function
- arrayOfArguments - An array which contains arrays of arguments just like: [[arg11,arg12,arg13],[arg21,arg22,arg23]]
Example
var promiseFall = require("promisefall");
var promiseFunc = function(arg1,arg2,arg3){
return Promise.resolve(arg1+arg2+arg3);
};
var argsArray = [];
for(var i = 0; i < 5; i++) {
argsArray.push([1,2,3]);
}
promiseFall(promiseFunc, argsArray).then(function(result) {
console.log(result);
});
// OUTPUT:
// [6,6,6,6,6]