@chubbyts/chubbyts-throwable-to-error 2.0.0 → 2.0.2
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/LICENSE +1 -1
- package/README.md +3 -3
- package/dist/{esm/throwable-to-error.js → throwable-to-error.js} +0 -1
- package/package.json +14 -18
- package/dist/cjs/throwable-to-error.js +0 -16
- package/dist/cjs/throwable-to-error.js.map +0 -1
- package/dist/esm/throwable-to-error.js.map +0 -1
- /package/dist/{types/throwable-to-error.d.ts → throwable-to-error.d.ts} +0 -0
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -30,13 +30,13 @@ It converts any throwable into an Error.
|
|
|
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.0.
|
|
33
|
+
npm i @chubbyts/chubbyts-throwable-to-error@^2.0.2
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
## Usage
|
|
37
37
|
|
|
38
38
|
```ts
|
|
39
|
-
import { throwableToError } from '@chubbyts/chubbyts-throwable-to-error/throwable-to-error';
|
|
39
|
+
import { throwableToError } from '@chubbyts/chubbyts-throwable-to-error/dist/throwable-to-error';
|
|
40
40
|
|
|
41
41
|
try {
|
|
42
42
|
throw {key: 'value'};
|
|
@@ -47,6 +47,6 @@ try {
|
|
|
47
47
|
|
|
48
48
|
## Copyright
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
2025 Dominik Zogg
|
|
51
51
|
|
|
52
52
|
[1]: https://www.npmjs.com/package/@chubbyts/chubbyts-throwable-to-error
|
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.0.
|
|
4
|
+
"version": "2.0.2",
|
|
5
5
|
"description": "It converts any throwable into an Error.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"chubbyts",
|
|
@@ -12,14 +12,11 @@
|
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"repository": "chubbyts/chubbyts-throwable-to-error",
|
|
14
14
|
"scripts": {
|
|
15
|
-
"build
|
|
16
|
-
"build:esm": "tsc --module ESNext --outDir dist/esm",
|
|
17
|
-
"build:types": "tsc --declaration --emitDeclarationOnly --outDir dist/types",
|
|
18
|
-
"build": "npm run build:cjs && npm run build:esm && npm run build:types",
|
|
15
|
+
"build": "tsc",
|
|
19
16
|
"cs-fix": "prettier --write src tests",
|
|
20
17
|
"cs": "prettier --check src tests",
|
|
21
18
|
"infection": "stryker run",
|
|
22
|
-
"lint-fix": "eslint src tests eslint.config.
|
|
19
|
+
"lint-fix": "eslint src tests eslint.config.js vitest.config.ts --fix",
|
|
23
20
|
"lint": "eslint src tests",
|
|
24
21
|
"prepare": "npm run build",
|
|
25
22
|
"test": "vitest"
|
|
@@ -35,24 +32,23 @@
|
|
|
35
32
|
],
|
|
36
33
|
"exports": {
|
|
37
34
|
"./*": {
|
|
38
|
-
"types": "
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"default": "./dist/esm/*.js"
|
|
35
|
+
"types": "./*.d.ts",
|
|
36
|
+
"import": "./*.js",
|
|
37
|
+
"default": "./*.js"
|
|
42
38
|
}
|
|
43
39
|
},
|
|
44
40
|
"engines": {
|
|
45
41
|
"node": ">=18"
|
|
46
42
|
},
|
|
47
43
|
"devDependencies": {
|
|
48
|
-
"@chubbyts/chubbyts-eslint": "^
|
|
49
|
-
"@stryker-mutator/core": "^
|
|
50
|
-
"@stryker-mutator/vitest-runner": "^
|
|
51
|
-
"@types/node": "^
|
|
52
|
-
"@vitest/coverage-v8": "^2.
|
|
53
|
-
"prettier": "^3.
|
|
54
|
-
"typescript": "^5.
|
|
55
|
-
"vitest": "^2.
|
|
44
|
+
"@chubbyts/chubbyts-eslint": "^4.0.2",
|
|
45
|
+
"@stryker-mutator/core": "^9.0.1",
|
|
46
|
+
"@stryker-mutator/vitest-runner": "^9.0.1",
|
|
47
|
+
"@types/node": "^24.0.1",
|
|
48
|
+
"@vitest/coverage-v8": "^3.2.3",
|
|
49
|
+
"prettier": "^3.5.3",
|
|
50
|
+
"typescript": "^5.8.3",
|
|
51
|
+
"vitest": "^3.2.3"
|
|
56
52
|
},
|
|
57
53
|
"publishConfig": {
|
|
58
54
|
"access": "public"
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.throwableToError = void 0;
|
|
4
|
-
const throwableToError = (e) => {
|
|
5
|
-
if (e instanceof Error) {
|
|
6
|
-
return e;
|
|
7
|
-
}
|
|
8
|
-
const error = new Error(typeof e === 'object' ? `${JSON.stringify(e)}` : `${String(e)}`);
|
|
9
|
-
// eslint-disable-next-line functional/immutable-data
|
|
10
|
-
error.name = typeof e;
|
|
11
|
-
// eslint-disable-next-line functional/immutable-data
|
|
12
|
-
error.stack = undefined;
|
|
13
|
-
return error;
|
|
14
|
-
};
|
|
15
|
-
exports.throwableToError = throwableToError;
|
|
16
|
-
//# sourceMappingURL=throwable-to-error.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwable-to-error.js","sourceRoot":"","sources":["../../src/throwable-to-error.ts"],"names":[],"mappings":";;;AAAO,MAAM,gBAAgB,GAAG,CAAC,CAAU,EAAS,EAAE;IACpD,IAAI,CAAC,YAAY,KAAK,EAAE,CAAC;QACvB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACzF,qDAAqD;IACrD,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC;IACtB,qDAAqD;IACrD,KAAK,CAAC,KAAK,GAAG,SAAS,CAAC;IAExB,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAZW,QAAA,gBAAgB,oBAY3B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throwable-to-error.js","sourceRoot":"","sources":["../../src/throwable-to-error.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAU,EAAS,EAAE;IACpD,IAAI,CAAC,YAAY,KAAK,EAAE,CAAC;QACvB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACzF,qDAAqD;IACrD,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC;IACtB,qDAAqD;IACrD,KAAK,CAAC,KAAK,GAAG,SAAS,CAAC;IAExB,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
|
File without changes
|