-
-
Save kypflug/9ff2b704dc08dc82bf22 to your computer and use it in GitHub Desktop.
This file contains 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 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