Skip to content

Instantly share code, notes, and snippets.

@thapakazi
Created November 14, 2013 12:21
Show Gist options
  • Save thapakazi/7465913 to your computer and use it in GitHub Desktop.
Save thapakazi/7465913 to your computer and use it in GitHub Desktop.
//function to process http request
httpRequest = function(message, path, action, options, callback) {
return message.http("" + BASEURL + "/" + path).query(options)[action]()(function(err, res, body) {
return callback(err, res, body);
});
};
//function call
httpRequest(msg, 'getDrink', 'post', {
coffee: "coffee",
tea: "tea"
}, function(err, msg, body) {
return console.log(body);
});
----------------------------------------------------------
## my problem is that,
how do I generate this object dynamically
{coffee: "coffee", tea: "tea" } ... from an array items=["coffee","tea"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment