3 ms·
getPosts (ids, cb) -> res = [] stash = (err, post) -> res.push post cb(res) if res.length is ids.length db.getPostBy
by ricardobeat 15y ago
getPosts (ids, cb) ->
res = []
stash = (err, post) ->
res.push post
cb(res) if res.length is ids.length
db.getPostById(id, stash) for id in ids
getPosts [...], (posts) ->
# go on...
use `res[i] = post` if there is some implicit ordering.