Skip to content

Instantly share code, notes, and snippets.

Created September 25, 2015 23:28
What would you like to do?
function httpGetJson(url) {
return spawn(function* () {
// check if the URL looks like a JSON file and call httpGet.
var regex = /\.(json)$/i;
if (regex.test(url)) {
// call the async function, wait for the result
return yield httpGet(url);
} else {
throw Error('Bad Url Format');
}, this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment