@chubbyts/chubbyts-decode-encode 1.0.0 → 1.0.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 CHANGED
@@ -33,7 +33,7 @@ A simple decode/encode solution for json / jsonx / url-encoded / xml / yaml.
33
33
  Through [NPM](https://www.npmjs.com) as [@chubbyts/chubbyts-decode-encode][1].
34
34
 
35
35
  ```ts
36
- npm i @chubbyts/chubbyts-decode-encode@^1.0.0
36
+ npm i @chubbyts/chubbyts-decode-encode@^1.0.1
37
37
  ```
38
38
 
39
39
  ## Usage
@@ -27,7 +27,7 @@ const createUrlEncodedTypeDecoder = () => {
27
27
  let data = {};
28
28
  encodedData.split('&').forEach((keyValue) => {
29
29
  const [rawKey, rawValue] = keyValue.split('=');
30
- const key = rawKey.replace(/\[[^\]]+\]/gm, (match) => `.${match.match(/[^\[\]]+/)[0]}`);
30
+ const key = decodeURIComponent(rawKey.replace(/\[[^\]]+\]/gm, (match) => `.${match.match(/[^\[\]]+/)[0]}`));
31
31
  const value = optimizeValue(decodeURIComponent(rawValue));
32
32
  (0, object_path_1.set)(data, key, value);
33
33
  });
@@ -15,7 +15,7 @@ const getValueAsString = (value) => {
15
15
  return value;
16
16
  };
17
17
  const getKeyValue = (path, key, value) => {
18
- const subPath = '' !== path ? path + '[' + key + ']' : key;
18
+ const subPath = '' !== path ? path + '[' + encodeURIComponent(key) + ']' : encodeURIComponent(key);
19
19
  if ((0, __1.isObject)(value) || (0, __1.isArray)(value)) {
20
20
  const queryPart = buildQuery(value, subPath);
21
21
  return queryPart !== '' ? queryPart + '&' : '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chubbyts/chubbyts-decode-encode",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A simple decode/encode solution for json / jsonx / url-encoded / xml / yaml.",
5
5
  "keywords": [
6
6
  "chubbyts",