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 1.0.1 to 1.0.2

build/src/enumerable.js

7

build/src/aggregate.js

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

import{setErrorProperty}from"./set.js";
import{setErrorProperty}from"./enumerable.js";

@@ -28,3 +28,6 @@

const isAggregateError=function(error){
return supportsAggregateError()&&error instanceof AggregateError;
return(
supportsAggregateError()&&(
error.name==="AggregateError"||error instanceof AggregateError));
};

@@ -31,0 +34,0 @@

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

import{setErrorProperty}from"./set.js";
import{setErrorProperty}from"./enumerable.js";

@@ -3,0 +3,0 @@

import{supportsAggregateError}from"./aggregate.js";
import{setErrorProperty}from"./set.js";
import{setErrorProperty}from"./enumerable.js";
import{setFullStack}from"./stack.js";
import{isPlainObj}from"./utils.js";
export const createError=function(value){
return isPlainObj(value)?objectifyError(value):stringifyError(value);
};
if(isPlainObj(value)){
return objectifyError(value);
}
const isPlainObj=function(value){
if(typeof value!=="object"||value===null){
return false;
if(isError(value)){
return value;
}
const prototype=Object.getPrototypeOf(value);
return prototype===Object.prototype||prototype===null;
return stringifyError(value);
};
const isError=function(value){
return objectToString.call(value)==="[object Error]";
};
const{toString:objectToString}=Object.prototype;
const objectifyError=function({

@@ -21,0 +30,0 @@ name,

import{normalizeAggregate}from"./aggregate.js";
import{normalizeCause}from"./cause.js";
import{createError}from"./create.js";
import{setErrorProperty}from"./set.js";
import{setErrorProperty,normalizeEnumerableProps}from"./enumerable.js";
import{setFullStack,fixStack}from"./stack.js";

@@ -20,12 +20,17 @@

const errorA=error instanceof Error?error:createError(error);
normalizeName(errorA);
normalizeMessage(errorA);
normalizeStack(errorA);
normalizeCause(errorA,recurse);
normalizeAggregate(errorA,recurse);
const errorA=createError(error);
normalizeProps(errorA,recurse);
return errorA;
};
const normalizeProps=function(error,recurse){
normalizeName(error);
normalizeMessage(error);
normalizeStack(error);
normalizeCause(error,recurse);
normalizeAggregate(error,recurse);
normalizeEnumerableProps(error);
};
const normalizeName=function(error){

@@ -32,0 +37,0 @@ if(!isDefinedString(error.name)){

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

import{setErrorProperty}from"./set.js";
import{setErrorProperty}from"./enumerable.js";

@@ -3,0 +3,0 @@

{
"name": "normalize-exception",
"version": "1.0.1",
"version": "1.0.2",
"type": "module",

@@ -5,0 +5,0 @@ "exports": "./build/src/main.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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