Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ghutils

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ghutils - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

43

ghutils.js

@@ -48,25 +48,31 @@ const jsonist = require('jsonist')

var issues = []
, optqs = qs.stringify(options)
var url = 'https://api.github.com/repos/' + org + '/' + repo + '/' + type + '?page=' + page + optqs
lister(auth, url, options, callback)
}
}
if (optqs)
optqs = '&' + optqs
//TODO: use 'Link' headers to improve the guesswork here
;(function next (page) {
var url = 'https://api.github.com/repos/' + org + '/' + repo + '/' + type + '?page=' + page + optqs
function lister (auth, urlbase, options, callback) {
var retdata = []
, optqs = qs.stringify(options)
ghget(auth, url, options, function (err, data) {
if (err)
return callback(err)
if (optqs)
optqs = '&' + optqs
if (!data.length)
return callback(null, issues)
//TODO: use 'Link' headers to improve the guesswork here
;(function next (page) {
var url = urlbase + '?page=' + page + optqs
issues.push.apply(issues, data)
ghget(auth, url, options, function (err, data) {
if (err)
return callback(err)
next(page + 1)
})
}(1))
}
if (!data.length)
return callback(null, retdata)
retdata.push.apply(retdata, data)
next(page + 1)
})
}(1))
}

@@ -79,2 +85,3 @@

module.exports.handler = handler
module.exports.issuesList = issuesList
module.exports.issuesList = issuesList
module.exports.lister = lister
{
"name": "ghutils",
"version": "1.0.0",
"version": "1.1.0",
"description": "A collection of utility functions for dealing with the GitHub API",

@@ -5,0 +5,0 @@ "main": "ghutils.js",

@@ -23,2 +23,6 @@ # ghutils

### lister(auth, urlbase, options, callback)
Given a paginated url resource, recursively fetch all available pages of data and return an array containing the complete list.
### issuesList(type)

@@ -30,2 +34,2 @@

**ghutils** is Copyright (c) 2015 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licensed under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.
**ghutils** is Copyright (c) 2015 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licensed under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc