@chubbyts/chubbyts-decode-encode 1.0.3 → 1.0.4
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
CHANGED
|
@@ -34,7 +34,7 @@ A simple decode/encode solution for json / jsonx / url-encoded / xml / yaml.
|
|
|
34
34
|
Through [NPM](https://www.npmjs.com) as [@chubbyts/chubbyts-decode-encode][1].
|
|
35
35
|
|
|
36
36
|
```ts
|
|
37
|
-
npm i @chubbyts/chubbyts-decode-encode@^1.0.
|
|
37
|
+
npm i @chubbyts/chubbyts-decode-encode@^1.0.4
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Usage
|
package/dist/encoder/index.d.ts
CHANGED
package/dist/encoder/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createEncoder = exports.
|
|
4
|
-
class
|
|
3
|
+
exports.createEncoder = exports.EncodeError = void 0;
|
|
4
|
+
class EncodeError extends Error {
|
|
5
5
|
}
|
|
6
|
-
exports.
|
|
6
|
+
exports.EncodeError = EncodeError;
|
|
7
7
|
const createEncoder = (encoderTypes) => {
|
|
8
8
|
const encoderTypeMap = new Map(encoderTypes.map((encoderType) => [encoderType.contentType, encoderType]));
|
|
9
9
|
const contentTypes = Array.from(encoderTypeMap.keys());
|
|
@@ -167,7 +167,7 @@ const createJsonxTypeEncoder = (prettyPrint = false) => {
|
|
|
167
167
|
}
|
|
168
168
|
catch (e) {
|
|
169
169
|
const error = (0, throwable_to_error_1.throwableToError)(e);
|
|
170
|
-
const decodeError = new _1.
|
|
170
|
+
const decodeError = new _1.EncodeError(error.message);
|
|
171
171
|
decodeError.stack = error.stack;
|
|
172
172
|
throw decodeError;
|
|
173
173
|
}
|