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

whoops

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

whoops - npm Package Compare versions

Comparing version 4.1.8 to 5.0.0

9

package.json

@@ -5,3 +5,3 @@ {

"homepage": "https://github.com/Kikobeats/whoops",
"version": "4.1.8",
"version": "5.0.0",
"main": "src/index.js",

@@ -37,6 +37,2 @@ "author": {

],
"dependencies": {
"clean-stack": "~3.0.0",
"mimic-fn": "~3.1.0"
},
"devDependencies": {

@@ -51,3 +47,2 @@ "@commitlint/cli": "latest",

"github-generate-release": "latest",
"mocha": "latest",
"nano-staged": "latest",

@@ -76,3 +71,3 @@ "should": "latest",

"release:tags": "git push --follow-tags origin HEAD:master",
"test": "c8 mocha"
"test": "c8 node --test"
},

@@ -79,0 +74,0 @@ "license": "MIT",

'use strict'
const createExtendError = require('./create-extend-error')
const createError = require('./create-error')
function createErrorClass (ErrorClass) {
return (name, defaults) => {
class CustomError extends ErrorClass {
constructor (raw = {}) {
super(raw)
const createErrorClass = ErrorClass => (className, props) => {
const errorClass = createError(className || ErrorClass.name)
return createExtendError(errorClass, props)
const { message, ...props } = typeof raw === 'string' ? { message: raw } : raw
const mergedProps = Object.assign({}, defaults, props)
Object.keys(mergedProps).forEach(key => (this[key] = mergedProps[key]))
if (message) this.description = typeof message === 'function' ? message(this) : message
this.message = this.code ? `${this.code}, ${this.description}` : this.description
this.name = name || ErrorClass.name
}
}
// Function to create an instance, allowing use without `new`
function CustomErrorFactory (props) {
return new CustomError(props)
}
// Ensure the function's name matches the class name for consistency
Object.defineProperty(CustomErrorFactory, 'name', {
value: name || ErrorClass.name,
writable: false
})
// Make `instanceof` checks work with both the class and factory
CustomErrorFactory.prototype = CustomError.prototype
return CustomErrorFactory
}
}

@@ -10,0 +36,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