@chubbyts/chubbyts-throwable-to-error 2.1.0 → 2.2.0
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 +2 -2
- package/package.json +20 -28
- package/dist/src/throwable-to-error.d.ts +0 -1
- package/dist/src/throwable-to-error.js +0 -11
package/README.md
CHANGED
|
@@ -23,14 +23,14 @@ It converts any throwable into an Error.
|
|
|
23
23
|
|
|
24
24
|
## Requirements
|
|
25
25
|
|
|
26
|
-
* node:
|
|
26
|
+
* node: 22
|
|
27
27
|
|
|
28
28
|
## Installation
|
|
29
29
|
|
|
30
30
|
Through [NPM](https://www.npmjs.com) as [@chubbyts/chubbyts-throwable-to-error][1].
|
|
31
31
|
|
|
32
32
|
```ts
|
|
33
|
-
npm i @chubbyts/chubbyts-throwable-to-error@^2.
|
|
33
|
+
npm i @chubbyts/chubbyts-throwable-to-error@^2.2.0
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
## Usage
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chubbyts/chubbyts-throwable-to-error",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.2.0",
|
|
5
5
|
"description": "It converts any throwable into an Error.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"chubbyts",
|
|
@@ -11,16 +11,6 @@
|
|
|
11
11
|
"author": "Dominik Zogg",
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"repository": "chubbyts/chubbyts-throwable-to-error",
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsc",
|
|
16
|
-
"cs-fix": "prettier --write src tests",
|
|
17
|
-
"cs": "prettier --check src tests",
|
|
18
|
-
"infection": "stryker run",
|
|
19
|
-
"lint-fix": "eslint src tests eslint.config.js vitest.config.ts --fix",
|
|
20
|
-
"lint": "eslint src tests",
|
|
21
|
-
"prepare": "pnpm run build",
|
|
22
|
-
"test": "vitest"
|
|
23
|
-
},
|
|
24
14
|
"prettier": {
|
|
25
15
|
"printWidth": 120,
|
|
26
16
|
"tabWidth": 2,
|
|
@@ -38,26 +28,28 @@
|
|
|
38
28
|
}
|
|
39
29
|
},
|
|
40
30
|
"engines": {
|
|
41
|
-
"node": ">=
|
|
31
|
+
"node": ">=22"
|
|
42
32
|
},
|
|
43
33
|
"devDependencies": {
|
|
44
|
-
"@chubbyts/chubbyts-eslint": "^5.
|
|
45
|
-
"@stryker-mutator/core": "^9.6.
|
|
46
|
-
"@stryker-mutator/vitest-runner": "^9.6.
|
|
47
|
-
"@types/node": "^25.6.
|
|
48
|
-
"@vitest/coverage-v8": "^4.1.
|
|
49
|
-
"prettier": "^3.8.
|
|
50
|
-
"typescript": "^6.0.
|
|
51
|
-
"vitest": "^4.1.
|
|
34
|
+
"@chubbyts/chubbyts-eslint": "^5.2.0",
|
|
35
|
+
"@stryker-mutator/core": "^9.6.1",
|
|
36
|
+
"@stryker-mutator/vitest-runner": "^9.6.1",
|
|
37
|
+
"@types/node": "^25.6.2",
|
|
38
|
+
"@vitest/coverage-v8": "^4.1.5",
|
|
39
|
+
"prettier": "^3.8.3",
|
|
40
|
+
"typescript": "^6.0.3",
|
|
41
|
+
"vitest": "^4.1.5"
|
|
52
42
|
},
|
|
53
43
|
"publishConfig": {
|
|
54
44
|
"access": "public"
|
|
55
45
|
},
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "rm -Rf dist && tsc",
|
|
48
|
+
"cs-fix": "prettier --write src tests",
|
|
49
|
+
"cs": "prettier --check src tests",
|
|
50
|
+
"infection": "stryker run",
|
|
51
|
+
"lint-fix": "eslint src tests eslint.config.js vitest.config.ts --fix",
|
|
52
|
+
"lint": "eslint src tests",
|
|
53
|
+
"test": "vitest"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const throwableToError: (e: unknown) => Error;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export const throwableToError = (e) => {
|
|
2
|
-
if (e instanceof Error) {
|
|
3
|
-
return e;
|
|
4
|
-
}
|
|
5
|
-
const error = new Error(typeof e === 'object' ? `${JSON.stringify(e)}` : `${String(e)}`);
|
|
6
|
-
// eslint-disable-next-line functional/immutable-data
|
|
7
|
-
error.name = typeof e;
|
|
8
|
-
// eslint-disable-next-line functional/immutable-data
|
|
9
|
-
error.stack = undefined;
|
|
10
|
-
return error;
|
|
11
|
-
};
|