Comparing version 3.2.2 to 3.2.4
@@ -9,6 +9,9 @@ const jsonist = require('jsonist') | ||
function makeOptions (auth, options) { | ||
return xtend({ | ||
headers : { 'User-Agent' : 'Magic Node.js application that does magic things' } | ||
, auth : auth.user + ':' + auth.token | ||
}, options) | ||
var headers = xtend( | ||
{ 'user-agent' : 'Magic Node.js application that does magic things' } | ||
, typeof options == 'object' && typeof options.headers == 'object' ? options.headers : {} | ||
) | ||
options = xtend({ auth: auth.user + ':' + auth.token }, options) | ||
options.headers = headers | ||
return options | ||
} | ||
@@ -47,6 +50,10 @@ | ||
, afterDate = (options.afterDate instanceof Date) && options.afterDate | ||
, optqsobj | ||
, optqs | ||
delete options.afterDate | ||
optqs = qs.stringify(options) | ||
// overloading use of 'options' is ... not great | ||
optqsobj = xtend(options) | ||
delete optqsobj.afterDate | ||
delete optqsobj.headers | ||
optqs = qs.stringify(optqsobj) | ||
@@ -67,2 +74,3 @@ ;(function next (url) { | ||
, createdAt | ||
if (nextUrl) { | ||
@@ -88,3 +96,4 @@ if (!afterDate || ( | ||
return | ||
var match = /<(.*)>; rel="next"/.exec(link) | ||
var match = /<([^>]+)>; rel="next"/.exec(link) | ||
return match && match[1] | ||
@@ -91,0 +100,0 @@ } |
{ | ||
"name": "ghutils", | ||
"version": "3.2.2", | ||
"version": "3.2.4", | ||
"description": "A collection of utility functions for dealing with the GitHub API", | ||
@@ -20,4 +20,4 @@ "main": "ghutils.js", | ||
"devDependencies": { | ||
"tape": "~4.0.0" | ||
"tape": "~4.9.0" | ||
} | ||
} |
@@ -54,3 +54,3 @@ const test = require('tape') | ||
response : [ { test1: 'data3', created_at: new Date('2015-12-12T05:58:14.421Z').toISOString() }, { test2: 'data4', created_at: new Date('2015-12-11T05:58:14.421Z').toISOString() } ] | ||
, headers : { link: '<https://api.github.com/foobar?page=3>; rel="next"' } | ||
, headers : { link: '<https://api.github.com/foobar?page=1>; rel="prev", <https://api.github.com/foobar?page=3>; rel="next", <https://api.github.com/foobar?page=4>; rel="last", <https://api.github.com/foobar?page=1>; rel="first"' } | ||
} | ||
@@ -57,0 +57,0 @@ , { response: [] } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14163
291