@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 CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2023 Dominik Zogg
1
+ Copyright (c) 2025 Dominik Zogg
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![CI](https://github.com/chubbyts/chubbyts-decode-encode/workflows/CI/badge.svg?branch=master)](https://github.com/chubbyts/chubbyts-decode-encode/actions?query=workflow%3ACI)
4
4
  [![Coverage Status](https://coveralls.io/repos/github/chubbyts/chubbyts-decode-encode/badge.svg?branch=master)](https://coveralls.io/github/chubbyts/chubbyts-decode-encode?branch=master)
5
- [![Infection MSI](https://badge.stryker-mutator.io/github.com/chubbyts/chubbyts-decode-encode/master)](https://dashboard.stryker-mutator.io/reports/github.com/chubbyts/chubbyts-decode-encode/master)
5
+ [![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fchubbyts%2Fchubbyts-decode-encode%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/chubbyts/chubbyts-decode-encode/master)
6
6
  [![npm-version](https://img.shields.io/npm/v/@chubbyts/chubbyts-decode-encode.svg)](https://www.npmjs.com/package/@chubbyts/chubbyts-decode-encode)
7
7
 
8
8
  [![bugs](https://sonarcloud.io/api/project_badges/measure?project=chubbyts_chubbyts-decode-encode&metric=bugs)](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: 16
27
- * [@chubbyts/chubbyts-throwable-to-error][2]: ^1.2.1
28
- * [fast-xml-parser][3]: ^4.3.1
29
- * [qs][4]: ^6.11.2
30
- * [yaml][5]: ^2.3.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.3.3
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
- 2023 Dominik Zogg
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.3.3",
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.js",
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": "jest"
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": ">=16"
65
+ "node": ">=18"
78
66
  },
79
67
  "dependencies": {
80
- "@chubbyts/chubbyts-throwable-to-error": "^1.2.1",
81
- "fast-xml-parser": "^4.3.1",
82
- "qs": "^6.11.2",
83
- "yaml": "^2.3.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": "^2.0.3",
87
- "@chubbyts/chubbyts-function-mock": "^1.4.1",
88
- "@chubbyts/chubbyts-packaging": "^2.0.4",
89
- "@stryker-mutator/core": "^7.1.0",
90
- "@stryker-mutator/jest-runner": "^7.1.0",
91
- "@types/jest": "^29.5.3",
92
- "@types/node": "^20.4.1",
93
- "@types/qs": "^6.9.7",
94
- "jest": "^29.6.1",
95
- "prettier": "^3.0.0",
96
- "ts-jest": "^29.1.1",
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"