New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

getrepos

Package Overview
Dependencies
Maintainers
2
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

getrepos - npm Package Compare versions

Comparing version 5.1.0 to 5.2.0-next.1589169553.bb4b42f520927474d1b308d4d8c3d76a828266d9

19

edition-browsers/index.js
/* eslint camelcase:0 */
import fetch from 'cross-fetch'
import { getHeaders } from 'githubauthreq'
import Pool from 'native-promise-pool'
const ghapi = process.env.GITHUB_API || 'https://api.github.com'
function halt(time) {
return new Promise(function (resolve, reject) {
setTimeout(resolve, time)
})
}
// =================================

@@ -16,2 +22,10 @@ // Fetch Repository

})
if (resp.status === 429) {
// wait a minute
console.warn(
`${url} returned 429, too many requests, trying again in a minute`
)
await halt(60)
return getRepo(repoFullName)
}
const data = await resp.json()

@@ -26,5 +40,6 @@ if (data && data.message) throw data.message

*/
export async function getRepos(repoFullNames) {
export async function getRepos(repoFullNames, concurrency = 0) {
const pool = new Pool(concurrency)
return await Promise.all(
repoFullNames.map((repoFullName) => getRepo(repoFullName))
repoFullNames.map((repoFullName) => pool.open(() => getRepo(repoFullName)))
)

@@ -31,0 +46,0 @@ }

@@ -11,3 +11,9 @@ 'use strict'

const githubauthreq_1 = require('githubauthreq')
const native_promise_pool_1 = __importDefault(require('native-promise-pool'))
const ghapi = process.env.GITHUB_API || 'https://api.github.com'
function halt(time) {
return new Promise(function (resolve, reject) {
setTimeout(resolve, time)
})
}
// =================================

@@ -24,2 +30,10 @@ // Fetch Repository

})
if (resp.status === 429) {
// wait a minute
console.warn(
`${url} returned 429, too many requests, trying again in a minute`
)
await halt(60)
return getRepo(repoFullName)
}
const data = await resp.json()

@@ -35,5 +49,6 @@ if (data && data.message) throw data.message

*/
async function getRepos(repoFullNames) {
async function getRepos(repoFullNames, concurrency = 0) {
const pool = new native_promise_pool_1.default(concurrency)
return await Promise.all(
repoFullNames.map((repoFullName) => getRepo(repoFullName))
repoFullNames.map((repoFullName) => pool.open(() => getRepo(repoFullName)))
)

@@ -40,0 +55,0 @@ }

# History
## v5.2.0 2020 May 11
- If status code `429` is returned, will try again in a minute
- Added optional `concurrency` argument to `getRepos`
- Updated dependencies, [base files](https://github.com/bevry/base), and [editions](https://editions.bevry.me) using [boundation](https://github.com/bevry/boundation)
## v5.1.0 2020 May 6

@@ -4,0 +10,0 @@

23

package.json
{
"title": "Get Repositories",
"name": "getrepos",
"version": "5.1.0",
"version": "5.2.0-next.1589169553.bb4b42f520927474d1b308d4d8c3d76a828266d9",
"description": "Fetch the specified repositories, or those that match a particular github user or search query",

@@ -110,3 +110,7 @@ "homepage": "https://github.com/bevry/getrepos",

"wishlistURL": "https://bevry.me/wishlist",
"travisTLD": "com"
"travisTLD": "com",
"githubUsername": "bevry",
"githubRepository": "getrepos",
"githubSlug": "bevry/getrepos",
"npmPackageName": "getrepos"
}

@@ -117,6 +121,6 @@ },

"maintainers": [
"Benjamin Lupton <b@lupton.cc> (http://balupton.com)"
"Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)"
],
"contributors": [
"Benjamin Lupton <b@lupton.cc> (http://balupton.com)"
"Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)"
],

@@ -179,17 +183,18 @@ "bugs": {

"cross-fetch": "^3.0.4",
"githubauthreq": "^5.1.1",
"githubauthreq": "^5.3.0",
"native-promise-pool": "^3.2.0",
"simplytyped": "^3.3.0"
},
"devDependencies": {
"@bevry/update-contributors": "^1.0.1",
"@bevry/update-contributors": "^1.2.0",
"@typescript-eslint/eslint-plugin": "^2.31.0",
"@typescript-eslint/parser": "^2.31.0",
"assert-helpers": "^6.2.0",
"eslint": "^6.8.0",
"eslint": "^7.0.0",
"eslint-config-bevry": "^3.4.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.3",
"kava": "^4.4.0",
"kava": "^5.0.0",
"prettier": "^2.0.5",
"projectz": "^1.19.1",
"projectz": "^2.0.0",
"surge": "^0.21.3",

@@ -196,0 +201,0 @@ "typedoc": "^0.17.6",

@@ -76,3 +76,3 @@ <!-- TITLE/ -->

<script type="module">
import * as pkg from '//cdn.pika.dev/getrepos/^5.1.0'
import * as pkg from '//cdn.pika.dev/getrepos/^5.2.0'
</script>

@@ -85,3 +85,3 @@ ```

<script type="module">
import * as pkg from '//unpkg.com/getrepos@^5.1.0'
import * as pkg from '//unpkg.com/getrepos@^5.2.0'
</script>

@@ -94,3 +94,3 @@ ```

<script type="module">
import * as pkg from '//dev.jspm.io/getrepos@5.1.0'
import * as pkg from '//dev.jspm.io/getrepos@5.2.0'
</script>

@@ -137,3 +137,3 @@ ```

<ul><li><a href="http://balupton.com">Benjamin Lupton</a> — <a href="https://github.com/bevry/getrepos/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/getrepos">view contributions</a></li></ul>
<ul><li><a href="https://github.com/balupton">Benjamin Lupton</a> — <a href="https://github.com/bevry/getrepos/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/getrepos">view contributions</a></li></ul>

@@ -158,4 +158,3 @@ <h3>Sponsors</h3>

<ul><li><a href="http://balupton.com">Benjamin Lupton</a> — <a href="https://github.com/bevry/getrepos/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/getrepos">view contributions</a></li>
<li><a href="http://github.com/apps/dependabot-preview">dependabot-preview[bot]</a> — <a href="https://github.com/bevry/getrepos/commits?author=dependabot-preview[bot]" title="View the GitHub contributions of dependabot-preview[bot] on repository bevry/getrepos">view contributions</a></li></ul>
<ul><li><a href="https://github.com/balupton">Benjamin Lupton</a> — <a href="https://github.com/bevry/getrepos/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/getrepos">view contributions</a></li></ul>

@@ -162,0 +161,0 @@ <a href="https://github.com/bevry/getrepos/blob/master/CONTRIBUTING.md#files">Discover how you can contribute by heading on over to the <code>CONTRIBUTING.md</code> file.</a>

@@ -7,4 +7,11 @@ /* eslint camelcase:0 */

import { getHeaders } from 'githubauthreq'
import Pool from 'native-promise-pool'
const ghapi = process.env.GITHUB_API || 'https://api.github.com'
function halt(time: number) {
return new Promise(function (resolve, reject) {
setTimeout(resolve, time)
})
}
// =================================

@@ -227,2 +234,10 @@ // Types

})
if (resp.status === 429) {
// wait a minute
console.warn(
`${url} returned 429, too many requests, trying again in a minute`
)
await halt(60)
return getRepo(repoFullName)
}
const data = (await resp.json()) as RepositoryResponse

@@ -238,5 +253,9 @@ if (data && data.message) throw data.message

*/
export async function getRepos(repoFullNames: string[]): Promise<Repository[]> {
export async function getRepos(
repoFullNames: string[],
concurrency: number = 0
): Promise<Repository[]> {
const pool = new Pool(concurrency)
return await Promise.all(
repoFullNames.map((repoFullName) => getRepo(repoFullName))
repoFullNames.map((repoFullName) => pool.open(() => getRepo(repoFullName)))
)

@@ -243,0 +262,0 @@ }

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