| 3 | |
| 4 | // Extracts the next page URL from Github API response. |
| 5 | const getNextPageUrl = response => { |
| 6 | const link = response.headers.get('link') |
| 7 | if (!link) { |
| 8 | return null |
| 9 | } |
| 10 | |
| 11 | const nextLink = link.split(',').find(s => s.indexOf('rel="next"') > -1) |
| 12 | if (!nextLink) { |
| 13 | return null |
| 14 | } |
| 15 | |
| 16 | return nextLink.trim().split(';')[0].slice(1, -1) |
| 17 | } |
| 18 | |
| 19 | const API_ROOT = 'https://api.github.com/' |
| 20 |