Yet another simple Promises/A+ compliant async flow control using ES6 generators.
- npm:
npm i lib-async
new Async(function* () {
try {
const users = yield getUsers();
const places = yield getPlaces(users);
return { users, places };
} catch (error) {
// Any errors in `getUsers` and/or `getPlaces` can be caught.
showError(error);
}
}).then(collections => {
// `collections` is now an object of users and places.
console.log(collections);
);