1.0.0 • Published 8 years ago

promisefall v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

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]