proq
Promise Sequence Module.
Terse and simple promise sequences for those who don't want to reinvent the wheel like i did :rocket: :whale: :boom:.
Install
npm i proq
npm i --save proq // to put it into your package.json
Usage
import proq from 'proq';
function magic1(params) {
// make some magic here ...
return new Promise(resolve => resolve(/* some result of our magic above */));
}
/* params is result of magic from magic1 */
function magic2(params) {
// more magic here ...
return new Promise(resolve => resolve(/* some result of our magic2 */));
}
proq([magic1, magic2], { unicorns: 10 } /* initial params */)
.then(resultOfAllMagic => console.log(resultOfAllMagic));
Functions magic1
and magic2
will be called sequentially and result of each one will be passed to next one.
Author
Stanislav Sysoev d4rkr00t@gmail.com https://github.com/d4rkr00t
License
Contributing
Contributing are highly welcome! This repos is commitizen friendly — please read about it here.