Socket
Socket
Sign inDemoInstall

simple-common-utils

Package Overview
Dependencies
0
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.5.0 to 2.5.1

32

js/StaticUtils.js

@@ -180,18 +180,26 @@ export default class StaticUtils {

static formatError(error) {
let result = "Start of error output:\n";
let result;
Object.entries(error).forEach(entry => {
const value = entry[1];
const errorEntries = Object.entries(error);
if (!errorEntries.length) {
result = error;
} else {
result = "Start of error output:\n";
const stringifier = [
Array,
Object,
undefined
].includes(value?.constructor) ? JSON.stringify : obj => obj.toString();
errorEntries.forEach(entry => {
const value = entry[1];
const stringifier = [
Array,
Object,
undefined
].includes(value?.constructor) ? JSON.stringify : obj => obj.toString();
result += `${entry[0]}: ${stringifier(value)}\n`;
});
result += `${entry[0]}: ${stringifier(value)}\n`;
});
result += "End of error output";
}
result += "End of error output";
return result;

@@ -198,0 +206,0 @@ }

@@ -21,3 +21,3 @@ {

},
"version": "2.5.0"
"version": "2.5.1"
}

@@ -185,3 +185,3 @@ This is a collection of utility classes used for JS development.

Enumerates the fields of the given argument with `Object.entries()` and returns a string based on the result.
Enumerates the fields of the given argument with `Object.entries()` and returns a string based on the result. Returns the given argument if it has no enumerable entries.

@@ -258,2 +258,3 @@ - objectToArray()

-|-
v2.5.1|`StaticUtils.formatError()`: fallback added.
v2.5.0|`StaticUtils.formatError()` added.

@@ -260,0 +261,0 @@ v2.4.0|1. `StaticUtils.today()`: `returnNow` added.<br>2. `package.json`: fields alphabetized.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc