Skip to content

Instantly share code, notes, and snippets.

@mikeal mikeal/gist:6429576
Last active Dec 22, 2015

Embed
What would you like to do?
function parselink (headers) {
var links = {}
if (!headers.link) {
return {}
}
headers.link.split(',').forEach(function (s) {
s = s.split(';')
var url = s[0].slice(s[0].indexOf('<')+1, s[0].length - 1)
, name = s[1].slice(' rel="'.length, s[1].length - 1)
;
links[name] = url
})
return links
}
var links = parselinks(resp.headers)
if (links.next) fetchurl(links.next)
else fetchurl(keys.shift())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.