I am performing a "GET" request to a url to get back a response, so i have a function that handles the request
var makeRequest = function(objs, callback){
    var url = 'adasda..';
    //...
    var result = null;
    request(url, function(error, response, body){
          if(!error && response.statusCode === 200){
                result = body;
                callback(null, body)
          }
    });
   return result;
}
In my main function i am invoking the above function
function main(values, callback){
  //...some logic
   var newValue={....}
   if(some conditional){
       newValue = makeRequest(values,callback); //newValue gets appended with new data
   }
   sendData(null, newValue, callback); //this function does a post 
}
var sendData = function(....){}
I noticed once makeRequest gets executed, it immediately goes ahead and then executes sendData and thats because the request module is an asynchronous operation.
How can i wait till the newValue object gets populated and then sendData() should be invoked?
 
    