import getRepoInfo from '../get-repo-info'

const resolvePrivatePackage = async (owner, repo, packageName) => {
  const response = await fetch(`https://registry.npmjs.org/${packageName}/latest`)

  if (response.status === 404) {
    console.warn(`[github-npm-stats] Couldn't find "${packageName}" in npm registry`)
    return null
  }

  const responseBody = await response.json()

  if (responseBody.bugs && responseBody.bugs.url) {
    const repoInfo = getRepoInfo(responseBody.bugs.url)
    if (repoInfo.owner === owner && repoInfo.repo === repo) {
      return packageName
    }
  }

  return null
}

export default resolvePrivatePackage

@@ -186,32 +186,43 @@
 /latest%60)%0A%0A  if 
+(Math.floor
 (response.status
@@ -225,15 +225,20 @@
 atus
+ / 100)
  === 
-40
 4) %7B

Check for and 4xx status in registry