title: How do I Promisify an Async operation, using the Async library?
body: <pre><code>GrabRedisDataByArray = Promise.promisify(function(data, callback) {
      var temp_results = [];
  
      async.each(data, function(result, done) {
  
          redis.hgetall('username:' + result, function(err, results) {
  
              temp_results.push(results);
              done();
          })
  
      }, function(err) {
          callback(temp_results)
      });
  
  });
  </code></pre>
  
  <p>Except, it's returning</p>
  
  <p><code>Unhandled rejection (&lt;[{"server":"9300","user_id":"31","char...&gt;, no stack trace )</code></p>
  
  <p>--That object data is just some user information stored in the <code>username:</code> key.</p>
  
  <hr>
  
  <p>And my method for data retrieval is:</p>
  
  <pre><code> GrabRedisDataByArray(data).then(function(data){
           console.log(data)                               
   });
  </code></pre>
  
  <p>I think my problem is with <code>GrabRedisDataByArray</code> and how it doesn't return anything in the main function scope, but only returns something through its second parameter? If that makes sense? I'm just kind of lost here and trying to understand how I can return that async operation to the main function instead of only returning it through the second parameter callback (Which is I think my promises isn't working correctly)</p>
  
  <p>Edit: This is using the <a href="https://github.com/petkaantonov/bluebird" rel="nofollow">Bluebird library</a></p>