A helpfull promises helpers
npm install smart-promisesA simple and helpful promises functions to work with Promises.
``npm i smart-promises`
Each promise will be executed only after previous in promises array
`
const { promiseWaterfall } = require('smart-promises');
const pool = Array.map((item) => () => promiseReturnFunction(item));
promiseWaterfall(pool)
.then((results) => {
});
`promiseMapLimit
When you have array of promises and don't want to use Promise.all (mass execution all of promises) - you can use promiseMapLimit, that can help you runs promises small chunks with defined limit.
`
const { promiseWaterfall } = require('smart-promises');
const pool = Array.map((item) => () => promiseReturnFunction(item));
promiseMapLimit(pool, 5)
.then((results) => {
});
``