title: returning results to outer function
body: <p>Not quite sure how to return result to outer function, i want to call getListOfUsers() and get returned list of results</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>function getListOfUsers() {
      userlist.getUsers(function(next, res) {
         var result = JSON.parse(res);
         var listOfUsers = result.members.map(function (mem) {
              return mem.name;
          });
      });
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>If i return outside of the map, it will obviously return undefined, or null if i define it outside and initiate it inside. 
  Using promises leaves me in same situation where my return is inside the 'then' function. Whats common practice here?</p>