Skip to content

Instantly share code, notes, and snippets.

@furf
Created September 18, 2015 23:00
Show Gist options
  • Save furf/70f129a850df2a7ef284 to your computer and use it in GitHub Desktop.
Save furf/70f129a850df2a7ef284 to your computer and use it in GitHub Desktop.
the hilarity of { "padded-blocks": [2, "always"] }
export function get(url, callback) {
return function handleGet(next) {
const request = require('request');
request(url, function handleRequest(error, response, body) {
if (error) {
return next(error);
}
try {
const data = JSON.parse(body);
next(null, callback(data));
} catch (parseError) {
next(parseError);
}
});
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment