Keeping Promise Chains Readable
问题 I've grown used to promise chaining arrays. It's incredibly easy to read a promise chain when each promise is a line long such as myArray.map(x => convertX) .filter() .whatever() .etc() This is incredibly easy to read. However, when I create promise chains with custom functions, it gets much messier. database.query(first query) .then(results => { // do stuff // do more // even more return database.query(second query) }) .then(results => { // rinse and repeat }) .catch(err => { // error