@chubbyts/chubbyts-decode-encode 1.4.0 → 1.4.1
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/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/package.json +5 -5
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ A simple decode/encode solution for json / jsonx / url-encoded / xml / yaml.
|
|
|
24
24
|
## Requirements
|
|
25
25
|
|
|
26
26
|
* node: 18
|
|
27
|
-
* [@chubbyts/chubbyts-throwable-to-error][2]: ^1.3.
|
|
27
|
+
* [@chubbyts/chubbyts-throwable-to-error][2]: ^1.3.2
|
|
28
28
|
* [fast-xml-parser][3]: ^4.5.1
|
|
29
29
|
* [qs][4]: ^6.13.1
|
|
30
30
|
* [yaml][5]: ^2.7.0
|
|
@@ -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.4.
|
|
37
|
+
npm i @chubbyts/chubbyts-decode-encode@^1.4.1
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Usage
|
|
@@ -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';
|
|
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';
|
|
4
|
+
import { DecodeError } from './index.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';
|
|
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';
|
|
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';
|
|
4
|
+
import { DATATYPE_ARRAY, DATATYPE_BOOLEAN, DATATYPE_NULL, DATATYPE_NUMBER, DATATYPE_OBJECT, DATATYPE_STRING, } from '../jsonx-datatypes.mjs';
|
|
5
|
+
import { EncodeError } from './index.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';
|
|
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chubbyts/chubbyts-decode-encode",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.1",
|
|
5
5
|
"description": "A simple decode/encode solution for json / jsonx / url-encoded / xml / yaml.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"chubbyts",
|
|
@@ -65,15 +65,15 @@
|
|
|
65
65
|
"node": ">=18"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@chubbyts/chubbyts-throwable-to-error": "^1.3.
|
|
68
|
+
"@chubbyts/chubbyts-throwable-to-error": "^1.3.2",
|
|
69
69
|
"fast-xml-parser": "^4.5.1",
|
|
70
70
|
"qs": "^6.13.1",
|
|
71
71
|
"yaml": "^2.7.0"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@chubbyts/chubbyts-eslint": "^3.0.
|
|
75
|
-
"@chubbyts/chubbyts-function-mock": "^1.5.
|
|
76
|
-
"@chubbyts/chubbyts-packaging": "^3.0.
|
|
74
|
+
"@chubbyts/chubbyts-eslint": "^3.0.3",
|
|
75
|
+
"@chubbyts/chubbyts-function-mock": "^1.5.2",
|
|
76
|
+
"@chubbyts/chubbyts-packaging": "^3.0.2",
|
|
77
77
|
"@stryker-mutator/core": "^8.7.1",
|
|
78
78
|
"@stryker-mutator/vitest-runner": "^8.7.1",
|
|
79
79
|
"@types/node": "^22.10.5",
|