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

normalize-exception

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

normalize-exception - npm Package Compare versions

Comparing version 2.6.0 to 2.7.0

30

build/src/create/main.js

@@ -0,1 +1,2 @@

import isErrorInstance from"is-error-instance";
import isPlainObj from"is-plain-obj";

@@ -15,4 +16,4 @@

if(!isError(value)){
return handleNonError(value);
if(!isErrorInstance(value)){
return stringifyError(value);
}

@@ -36,27 +37,16 @@

const isError=function(value){
try{
const isInvalidError=function(value){
return(
objectToString.call(value)==="[object Error]"&&
!(Symbol.toStringTag in value));
isProxy(value)||
isNonModifiableError(value)||
hasInvalidConstructor(value));
}catch{
return false;
}
};
const handleNonError=function(value){
return isProxy(value)?objectifyError(value):stringifyError(value);
};
const isProxy=function(value){
try{
return value instanceof Error;
return objectToString.call(value)==="[object Object]";
}catch{

@@ -67,8 +57,4 @@ return true;

const isInvalidError=function(value){
return isNonModifiableError(value)||hasInvalidConstructor(value);
};
const hasInvalidConstructor=function(error){

@@ -75,0 +61,0 @@ return(

{
"name": "normalize-exception",
"version": "2.6.0",
"version": "2.7.0",
"type": "module",

@@ -49,4 +49,4 @@ "exports": "./build/src/main.js",

"devDependencies": {
"@ehmicky/dev-tasks": "^1.0.88",
"test-each": "^5.4.0"
"@ehmicky/dev-tasks": "^1.0.94",
"test-each": "^5.4.1"
},

@@ -57,4 +57,5 @@ "engines": {

"dependencies": {
"is-error-instance": "^1.1.0",
"is-plain-obj": "^4.1.0"
}
}

@@ -363,2 +363,4 @@ [![Codecov](https://img.shields.io/codecov/c/github/ehmicky/normalize-exception.svg?label=tested&logo=codecov)](https://codecov.io/gh/ehmicky/normalize-exception)

error with its `cause`
- [`is-error-instance`](https://github.com/ehmicky/is-error-instance): Check if
a value is an `Error` instance
- [`set-error-class`](https://github.com/ehmicky/set-error-class): Properly

@@ -365,0 +367,0 @@ update an error's class

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