Hacker News new | comments | show | ask | jobs | submit login

Great takeaway, jrockway. For his other example, I encourage people to take a look at caolan's excellent async library:

    function(callback) {
      async.map(ids, db.getById, callback)
    function(posts, callback) {
      callback(null, posts.map(templating.render))
  ], function(err, results) {
EDIT: Fixed example.

Personally I've gotten more use out of the Futures library, though both are great. https://github.com/coolaj86/futures It contains a form of 'waterfall' known as merely a sequence. I use a lot of sequences and promises, it makes me not go insane from NodeJS programming. In the end I still think it was a mistake for Node to not support any sync features because there are times it's nice to have. TameJS doesn't solve the problem completely either (and I hate the compile step).

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact