Socket
Socket
Sign inDemoInstall

npm-registry-fetch

Package Overview
Dependencies
Maintainers
5
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

npm-registry-fetch - npm Package Compare versions

Comparing version 17.0.0 to 17.0.1

26

lib/errors.js
'use strict'
const url = require('url')
const { URL } = require('node:url')
function packageName (href) {
try {
let basePath = new url.URL(href).pathname.slice(1)
let basePath = new URL(href).pathname.slice(1)
if (!basePath.match(/^-/)) {

@@ -18,3 +18,3 @@ basePath = basePath.split('/')

}
} catch (_) {
} catch {
// this is ok

@@ -28,3 +28,3 @@ }

this.name = this.constructor.name
this.headers = res.headers.raw()
this.headers = typeof res.headers?.raw === 'function' ? res.headers.raw() : res.headers
this.statusCode = res.status

@@ -36,5 +36,5 @@ this.code = `E${res.status}`

this.pkgid = spec ? spec.toString() : packageName(res.url)
Error.captureStackTrace(this, this.constructor)
}
}
module.exports.HttpErrorBase = HttpErrorBase

@@ -51,6 +51,4 @@ class HttpErrorGeneral extends HttpErrorBase {

}`
Error.captureStackTrace(this, HttpErrorGeneral)
}
}
module.exports.HttpErrorGeneral = HttpErrorGeneral

@@ -62,6 +60,4 @@ class HttpErrorAuthOTP extends HttpErrorBase {

this.code = 'EOTP'
Error.captureStackTrace(this, HttpErrorAuthOTP)
}
}
module.exports.HttpErrorAuthOTP = HttpErrorAuthOTP

@@ -73,6 +69,4 @@ class HttpErrorAuthIPAddress extends HttpErrorBase {

this.code = 'EAUTHIP'
Error.captureStackTrace(this, HttpErrorAuthIPAddress)
}
}
module.exports.HttpErrorAuthIPAddress = HttpErrorAuthIPAddress

@@ -83,5 +77,11 @@ class HttpErrorAuthUnknown extends HttpErrorBase {

this.message = 'Unable to authenticate, need: ' + res.headers.get('www-authenticate')
Error.captureStackTrace(this, HttpErrorAuthUnknown)
}
}
module.exports.HttpErrorAuthUnknown = HttpErrorAuthUnknown
module.exports = {
HttpErrorBase,
HttpErrorGeneral,
HttpErrorAuthOTP,
HttpErrorAuthIPAddress,
HttpErrorAuthUnknown,
}
{
"name": "npm-registry-fetch",
"version": "17.0.0",
"version": "17.0.1",
"description": "Fetch-based http client for use with npm registry APIs",

@@ -5,0 +5,0 @@ "main": "lib",

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