Skip to content

Instantly share code, notes, and snippets.

@IPRIT
Created April 11, 2015 19:54
Show Gist options
  • Select an option

  • Save IPRIT/21013d5ead0707b7eace to your computer and use it in GitHub Desktop.

Select an option

Save IPRIT/21013d5ead0707b7eace to your computer and use it in GitHub Desktop.
function loadUsers(userIds, load, done) {
var completed = 0;
var users = [];
userIds.forEach(function(id, index) {
load(id, function(user) {
users[index] = user;
if (++completed === userIds.length)
return done(users);
})
})
}
module.exports = loadUsers;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment