@chubbyts/chubbyts-decode-encode 1.3.3 → 1.4.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/LICENSE +1 -1
- package/README.md +8 -8
- package/dist/decoder/json-type-decoder.mjs +1 -1
- package/dist/decoder/jsonx-type-decoder.mjs +2 -2
- package/dist/decoder/url-encoded-type-decoder.mjs +1 -1
- package/dist/decoder/yaml-type-decoder.mjs +1 -1
- package/dist/encoder/jsonx-type-encoder.mjs +3 -3
- package/dist/encoder/url-encoded-type-encoder.mjs +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +20 -33
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/chubbyts/chubbyts-decode-encode/actions?query=workflow%3ACI)
|
|
4
4
|
[](https://coveralls.io/github/chubbyts/chubbyts-decode-encode?branch=master)
|
|
5
|
-
[](https://dashboard.stryker-mutator.io/reports/github.com/chubbyts/chubbyts-decode-encode/master)
|
|
6
6
|
[](https://www.npmjs.com/package/@chubbyts/chubbyts-decode-encode)
|
|
7
7
|
|
|
8
8
|
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-decode-encode)
|
|
@@ -23,18 +23,18 @@ A simple decode/encode solution for json / jsonx / url-encoded / xml / yaml.
|
|
|
23
23
|
|
|
24
24
|
## Requirements
|
|
25
25
|
|
|
26
|
-
* node:
|
|
27
|
-
* [@chubbyts/chubbyts-throwable-to-error][2]: ^1.
|
|
28
|
-
* [fast-xml-parser][3]: ^4.
|
|
29
|
-
* [qs][4]: ^6.
|
|
30
|
-
* [yaml][5]: ^2.
|
|
26
|
+
* node: 18
|
|
27
|
+
* [@chubbyts/chubbyts-throwable-to-error][2]: ^1.3.0
|
|
28
|
+
* [fast-xml-parser][3]: ^4.5.1
|
|
29
|
+
* [qs][4]: ^6.13.1
|
|
30
|
+
* [yaml][5]: ^2.7.0
|
|
31
31
|
|
|
32
32
|
## Installation
|
|
33
33
|
|
|
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.
|
|
37
|
+
npm i @chubbyts/chubbyts-decode-encode@^1.4.0
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Usage
|
|
@@ -175,7 +175,7 @@ const contentType = yamlTypeEncoder.contentType;
|
|
|
175
175
|
|
|
176
176
|
## Copyright
|
|
177
177
|
|
|
178
|
-
|
|
178
|
+
2025 Dominik Zogg
|
|
179
179
|
|
|
180
180
|
[1]: https://www.npmjs.com/package/@chubbyts/chubbyts-decode-encode
|
|
181
181
|
[2]: https://www.npmjs.com/package/@chubbyts/chubbyts-throwable-to-error
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { throwableToError } from '@chubbyts/chubbyts-throwable-to-error/dist/throwable-to-error';
|
|
2
|
-
import { DecodeError } from './index.mjs';
|
|
2
|
+
import { DecodeError } from './index.mjs.mjs';
|
|
3
3
|
export const createJsonTypeDecoder = () => {
|
|
4
4
|
return {
|
|
5
5
|
decode: (encodedData) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { XMLParser } from 'fast-xml-parser';
|
|
2
2
|
import { throwableToError } from '@chubbyts/chubbyts-throwable-to-error/dist/throwable-to-error';
|
|
3
|
-
import { DATATYPE_ARRAY, DATATYPE_BOOLEAN, DATATYPE_NULL, DATATYPE_NUMBER, DATATYPE_OBJECT, DATATYPE_STRING, } from '../jsonx-datatypes.mjs';
|
|
4
|
-
import { DecodeError } from './index.mjs';
|
|
3
|
+
import { DATATYPE_ARRAY, DATATYPE_BOOLEAN, DATATYPE_NULL, DATATYPE_NUMBER, DATATYPE_OBJECT, DATATYPE_STRING, } from '../jsonx-datatypes.mjs.mjs';
|
|
4
|
+
import { DecodeError } from './index.mjs.mjs';
|
|
5
5
|
const decodeHtmlEntities = (string) => string.replace(/&#\d+;/gm, (code) => String.fromCharCode(code.match(/\d+/)[0]));
|
|
6
6
|
const isWithName = (node) => typeof node === 'object' &&
|
|
7
7
|
null !== node &&
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parse } from 'qs';
|
|
2
|
-
import { isArray, isObject } from '../index.mjs';
|
|
2
|
+
import { isArray, isObject } from '../index.mjs.mjs';
|
|
3
3
|
const decodeValue = (value) => {
|
|
4
4
|
if (isObject(value)) {
|
|
5
5
|
return Object.fromEntries(Object.entries(value).map(([subKey, subValue]) => [subKey, decodeValue(subValue)]));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parse } from 'yaml';
|
|
2
2
|
import { throwableToError } from '@chubbyts/chubbyts-throwable-to-error/dist/throwable-to-error';
|
|
3
|
-
import { DecodeError } from './index.mjs';
|
|
3
|
+
import { DecodeError } from './index.mjs.mjs';
|
|
4
4
|
export const createYamlTypeDecoder = () => {
|
|
5
5
|
return {
|
|
6
6
|
decode: (encodedData) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { XMLBuilder } from 'fast-xml-parser';
|
|
2
2
|
import { throwableToError } from '@chubbyts/chubbyts-throwable-to-error/dist/throwable-to-error';
|
|
3
|
-
import { isArray, isBoolean, isNumber, isObject, isString, isNull } from '../index.mjs';
|
|
4
|
-
import { DATATYPE_ARRAY, DATATYPE_BOOLEAN, DATATYPE_NULL, DATATYPE_NUMBER, DATATYPE_OBJECT, DATATYPE_STRING, } from '../jsonx-datatypes.mjs';
|
|
5
|
-
import { EncodeError } from './index.mjs';
|
|
3
|
+
import { isArray, isBoolean, isNumber, isObject, isString, isNull } from '../index.mjs.mjs';
|
|
4
|
+
import { DATATYPE_ARRAY, DATATYPE_BOOLEAN, DATATYPE_NULL, DATATYPE_NUMBER, DATATYPE_OBJECT, DATATYPE_STRING, } from '../jsonx-datatypes.mjs.mjs';
|
|
5
|
+
import { EncodeError } from './index.mjs.mjs';
|
|
6
6
|
const encodeHtmlEntities = (string) => string.replace(/[\u00A0-\u9999<>&]/g, (i) => '&#' + i.charCodeAt(0) + ';');
|
|
7
7
|
const createXmlNode = () => {
|
|
8
8
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { stringify } from 'qs';
|
|
2
|
-
import { isArray, isBoolean, isNull, isNumber, isObject } from '../index.mjs';
|
|
2
|
+
import { isArray, isBoolean, isNull, isNumber, isObject } from '../index.mjs.mjs';
|
|
3
3
|
const encodeValue = (value) => {
|
|
4
4
|
if (isObject(value)) {
|
|
5
5
|
return Object.fromEntries(Object.entries(value).map(([subKey, subValue]) => [subKey, encodeValue(subValue)]));
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const isNull: (value: unknown) => value is null;
|
|
|
5
5
|
export declare const isBoolean: (value: unknown) => value is boolean;
|
|
6
6
|
export declare const isNumber: (value: unknown) => value is number;
|
|
7
7
|
export declare const isString: (value: unknown) => value is string;
|
|
8
|
-
export declare const isArray: (value: unknown) => value is Data
|
|
8
|
+
export declare const isArray: (value: unknown) => value is Array<Data>;
|
|
9
9
|
export declare const isObject: (value: unknown) => value is {
|
|
10
10
|
[key: string]: Data;
|
|
11
11
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chubbyts/chubbyts-decode-encode",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.0",
|
|
5
5
|
"description": "A simple decode/encode solution for json / jsonx / url-encoded / xml / yaml.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"chubbyts",
|
|
@@ -17,26 +17,14 @@
|
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"repository": "chubbyts/chubbyts-decode-encode",
|
|
19
19
|
"scripts": {
|
|
20
|
-
"build": "node ./build.
|
|
20
|
+
"build": "node ./build.mjs",
|
|
21
21
|
"cs-fix": "prettier --write src tests",
|
|
22
22
|
"cs": "prettier --check src tests",
|
|
23
23
|
"infection": "stryker run",
|
|
24
|
-
"lint-fix": "eslint src tests --fix",
|
|
24
|
+
"lint-fix": "eslint src tests eslint.config.mjs vitest.config.ts --fix",
|
|
25
25
|
"lint": "eslint src tests",
|
|
26
26
|
"prepare": "npm run build",
|
|
27
|
-
"test": "
|
|
28
|
-
},
|
|
29
|
-
"jest": {
|
|
30
|
-
"preset": "ts-jest",
|
|
31
|
-
"testEnvironment": "node",
|
|
32
|
-
"collectCoverageFrom": [
|
|
33
|
-
"src/**/*.ts"
|
|
34
|
-
],
|
|
35
|
-
"coverageThreshold": {
|
|
36
|
-
"global": {
|
|
37
|
-
"lines": 100
|
|
38
|
-
}
|
|
39
|
-
}
|
|
27
|
+
"test": "vitest"
|
|
40
28
|
},
|
|
41
29
|
"prettier": {
|
|
42
30
|
"printWidth": 120,
|
|
@@ -74,27 +62,26 @@
|
|
|
74
62
|
}
|
|
75
63
|
},
|
|
76
64
|
"engines": {
|
|
77
|
-
"node": ">=
|
|
65
|
+
"node": ">=18"
|
|
78
66
|
},
|
|
79
67
|
"dependencies": {
|
|
80
|
-
"@chubbyts/chubbyts-throwable-to-error": "^1.
|
|
81
|
-
"fast-xml-parser": "^4.
|
|
82
|
-
"qs": "^6.
|
|
83
|
-
"yaml": "^2.
|
|
68
|
+
"@chubbyts/chubbyts-throwable-to-error": "^1.3.0",
|
|
69
|
+
"fast-xml-parser": "^4.5.1",
|
|
70
|
+
"qs": "^6.13.1",
|
|
71
|
+
"yaml": "^2.7.0"
|
|
84
72
|
},
|
|
85
73
|
"devDependencies": {
|
|
86
|
-
"@chubbyts/chubbyts-eslint": "^
|
|
87
|
-
"@chubbyts/chubbyts-function-mock": "^1.
|
|
88
|
-
"@chubbyts/chubbyts-packaging": "^
|
|
89
|
-
"@stryker-mutator/core": "^7.1
|
|
90
|
-
"@stryker-mutator/
|
|
91
|
-
"@types/
|
|
92
|
-
"@types/
|
|
93
|
-
"@
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"typescript": "^5.1.6"
|
|
74
|
+
"@chubbyts/chubbyts-eslint": "^3.0.1",
|
|
75
|
+
"@chubbyts/chubbyts-function-mock": "^1.5.1",
|
|
76
|
+
"@chubbyts/chubbyts-packaging": "^3.0.0",
|
|
77
|
+
"@stryker-mutator/core": "^8.7.1",
|
|
78
|
+
"@stryker-mutator/vitest-runner": "^8.7.1",
|
|
79
|
+
"@types/node": "^22.10.5",
|
|
80
|
+
"@types/qs": "^6.9.17",
|
|
81
|
+
"@vitest/coverage-v8": "^2.1.8",
|
|
82
|
+
"prettier": "^3.4.2",
|
|
83
|
+
"typescript": "^5.7.2",
|
|
84
|
+
"vitest": "^2.1.8"
|
|
98
85
|
},
|
|
99
86
|
"publishConfig": {
|
|
100
87
|
"access": "public"
|