simple-common-utils
Advanced tools
Comparing version 2.4.0 to 2.5.0
@@ -179,2 +179,22 @@ export default class StaticUtils { | ||
static formatError(error) { | ||
let result = "Start of error output:\n"; | ||
Object.entries(error).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 += "End of error output"; | ||
return result; | ||
} | ||
static objectToArray(object) { | ||
@@ -181,0 +201,0 @@ return Object.keys(object).reduce((p, c) => { |
@@ -21,3 +21,3 @@ { | ||
}, | ||
"version": "2.4.0" | ||
"version": "2.5.0" | ||
} |
@@ -183,2 +183,6 @@ This is a collection of utility classes used for JS development. | ||
- formatError(error) | ||
Enumerates the fields of the given argument with `Object.entries()` and returns a string based on the result. | ||
- objectToArray() | ||
@@ -254,2 +258,3 @@ | ||
-|- | ||
v2.5.0|`StaticUtils.formatError()` added. | ||
v2.4.0|1. `StaticUtils.today()`: `returnNow` added.<br>2. `package.json`: fields alphabetized. | ||
@@ -256,0 +261,0 @@ v2.3.0|`StaticUtils.today()` added. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35812
707
275