async and Q promises in nodejs

Viewed 7556

I'm using the Q library and async library in nodejs.

Here's an example of my code:

async.each(items, cb, function(item) {

 saveItem.then(function(doc) {
    cb();
 });

}, function() {

});

saveItem is a promise. When I run this, I always get cb is undefined, I guess then() doesn't have access. Any ideas how to work around this?

1 Answers
Related