Skip to content

Instantly share code, notes, and snippets.

@m-rd-r
Last active August 29, 2015 14:12
Show Gist options
  • Select an option

  • Save m-rd-r/c25002202920d2b7149e to your computer and use it in GitHub Desktop.

Select an option

Save m-rd-r/c25002202920d2b7149e to your computer and use it in GitHub Desktop.
ES6 stuff
function http_get(url, { sayHi, verbose: v }, userAgent = "Kitchen sink 2.0") {
if (sayHi) {
console.log("HI!");
}
if (v) {
console.log("Sending request");
}
return require('http').get({
url,
headers: {
"User-Agent": userAgent
}
});
}
// ...
http_get("http://icanhazip.com", { verbose: true, sayHi: false });
@m-rd-r
Copy link
Author

m-rd-r commented Jan 3, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment