@common.js/serialize-error 11.0.1 → 11.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/index.js +7 -5
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
The [serialize-error](https://www.npmjs.com/package/serialize-error) package exported as CommonJS modules.
|
|
4
4
|
|
|
5
|
-
Exported from [serialize-error@11.0.
|
|
5
|
+
Exported from [serialize-error@11.0.3](https://www.npmjs.com/package/serialize-error/v/11.0.3) using https://github.com/etienne-martin/common.js.
|
package/index.js
CHANGED
|
@@ -344,8 +344,7 @@ var destroyCircular = function(param) {
|
|
|
344
344
|
try {
|
|
345
345
|
for(var _iterator = Object.entries(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
346
346
|
var _value = _slicedToArray(_step.value, 2), key = _value[0], value = _value[1];
|
|
347
|
-
|
|
348
|
-
if (typeof Buffer === "function" && Buffer.isBuffer(value)) {
|
|
347
|
+
if (value && _instanceof(value, Uint8Array) && value.constructor.name === "Buffer") {
|
|
349
348
|
to[key] = "[object Buffer]";
|
|
350
349
|
continue;
|
|
351
350
|
}
|
|
@@ -358,7 +357,10 @@ var destroyCircular = function(param) {
|
|
|
358
357
|
continue;
|
|
359
358
|
}
|
|
360
359
|
if (!value || typeof value !== "object") {
|
|
361
|
-
|
|
360
|
+
// Gracefully handle non-configurable errors like `DOMException`.
|
|
361
|
+
try {
|
|
362
|
+
to[key] = value;
|
|
363
|
+
} catch (e) {}
|
|
362
364
|
continue;
|
|
363
365
|
}
|
|
364
366
|
if (!seen.includes(from[key])) {
|
|
@@ -427,9 +429,9 @@ function serializeError(value) {
|
|
|
427
429
|
}
|
|
428
430
|
// People sometimes throw things besides Error objects…
|
|
429
431
|
if (typeof value === "function") {
|
|
430
|
-
var _name;
|
|
431
432
|
// `JSON.stringify()` discards functions. We do too, unless a function is thrown directly.
|
|
432
|
-
|
|
433
|
+
// We intentionally use `||` because `.name` is an empty string for anonymous functions.
|
|
434
|
+
return "[Function: ".concat(value.name || "anonymous", "]");
|
|
433
435
|
}
|
|
434
436
|
return value;
|
|
435
437
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@common.js/serialize-error",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.3",
|
|
4
4
|
"description": "serialize-error package exported as CommonJS modules",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "etienne-martin/common.js",
|
|
7
7
|
"funding": "https://github.com/sponsors/sindresorhus",
|
|
8
8
|
"type": "commonjs",
|
|
9
|
+
"sideEffects": false,
|
|
9
10
|
"engines": {
|
|
10
11
|
"node": ">=14.16"
|
|
11
12
|
},
|