Last active
August 29, 2015 14:12
-
-
Save prodev247/c25002202920d2b7149e to your computer and use it in GitHub Desktop.
ES6 stuff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
transpiled to ES5: https://gist.github.com/Vorlot/9d2eb926548f0e29e76e