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.5.0 to 1.6.0

29

build/src/create/object.js

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

import safeJsonValue from"safe-json-value";
import{setErrorProperty}from"../descriptors.js";

@@ -33,10 +31,29 @@ import{setFullStack}from"../stack.js";

const getMessage=function(message,object){
if(typeof message==="string"&&message!==""){
return message;
return typeof message==="string"&&message!==""?
message:
truncateMessage(safeJsonStringify(object));
};
const safeJsonStringify=function(object){
try{
return JSON.stringify(object);
}catch{
return safeStringify(object);
}
};
const{value}=safeJsonValue(object,{maxSize:MESSAGE_MAX_SIZE});
return value===undefined?"Invalid error":JSON.stringify(value);
const safeStringify=function(object){
try{
return String(object);
}catch{
return"Invalid error";
}
};
const truncateMessage=function(message){
return message.length<MESSAGE_MAX_SIZE?
message:
`${message.slice(0,MESSAGE_MAX_SIZE)}...`;
};
const MESSAGE_MAX_SIZE=1e3;

@@ -43,0 +60,0 @@

{
"name": "normalize-exception",
"version": "1.5.0",
"version": "1.6.0",
"type": "module",

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

"dependencies": {
"is-plain-obj": "^4.1.0",
"safe-json-value": "^1.5.0"
"is-plain-obj": "^4.1.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