@uxf/router 11.22.0 → 11.32.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/helper.js CHANGED
@@ -1,13 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.queryParamToNumberStrict = exports.queryParamToNumber = exports.queryParamToBooleanStrict = exports.queryParamToBoolean = exports.queryParamToStringStrict = exports.queryParamToString = void 0;
3
+ exports.queryParamToString = queryParamToString;
4
+ exports.queryParamToStringStrict = queryParamToStringStrict;
5
+ exports.queryParamToBoolean = queryParamToBoolean;
6
+ exports.queryParamToBooleanStrict = queryParamToBooleanStrict;
7
+ exports.queryParamToNumber = queryParamToNumber;
8
+ exports.queryParamToNumberStrict = queryParamToNumberStrict;
4
9
  function queryParamToString(param) {
5
10
  if (Array.isArray(param)) {
6
11
  throw new Error(`Query parameter is array. Should be string.`);
7
12
  }
8
13
  return param;
9
14
  }
10
- exports.queryParamToString = queryParamToString;
11
15
  function queryParamToStringStrict(param) {
12
16
  const paramOrUndefined = queryParamToString(param);
13
17
  if (paramOrUndefined === undefined) {
@@ -15,7 +19,6 @@ function queryParamToStringStrict(param) {
15
19
  }
16
20
  return paramOrUndefined;
17
21
  }
18
- exports.queryParamToStringStrict = queryParamToStringStrict;
19
22
  function queryParamToBoolean(param) {
20
23
  if (Array.isArray(param)) {
21
24
  throw new Error(`Query parameter is array. Should be string.`);
@@ -31,7 +34,6 @@ function queryParamToBoolean(param) {
31
34
  }
32
35
  throw new Error(`Parameter should be boolean (true|false). Given '${param}'.`);
33
36
  }
34
- exports.queryParamToBoolean = queryParamToBoolean;
35
37
  function queryParamToBooleanStrict(param) {
36
38
  const paramOrUndefined = queryParamToBoolean(param);
37
39
  if (paramOrUndefined === undefined) {
@@ -39,7 +41,6 @@ function queryParamToBooleanStrict(param) {
39
41
  }
40
42
  return paramOrUndefined;
41
43
  }
42
- exports.queryParamToBooleanStrict = queryParamToBooleanStrict;
43
44
  function queryParamToNumber(param) {
44
45
  if (Array.isArray(param)) {
45
46
  throw new Error(`Query parameter is array. Should be number.`);
@@ -53,7 +54,6 @@ function queryParamToNumber(param) {
53
54
  }
54
55
  return numberParam;
55
56
  }
56
- exports.queryParamToNumber = queryParamToNumber;
57
57
  function queryParamToNumberStrict(param) {
58
58
  const paramOrUndefined = queryParamToNumber(param);
59
59
  if (paramOrUndefined === undefined) {
@@ -61,4 +61,3 @@ function queryParamToNumberStrict(param) {
61
61
  }
62
62
  return paramOrUndefined;
63
63
  }
64
- exports.queryParamToNumberStrict = queryParamToNumberStrict;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/router",
3
- "version": "11.22.0",
3
+ "version": "11.32.0",
4
4
  "description": "UXF Router",
5
5
  "author": "UXFans <dev@uxf.cz>",
6
6
  "homepage": "https://gitlab.com/uxf-npm/router#readme",
@@ -23,13 +23,13 @@
23
23
  "url": "https://gitlab.com/uxf-npm/router/issues"
24
24
  },
25
25
  "dependencies": {
26
- "qs": "6.11.2"
26
+ "qs": "6.13.0"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "next": ">= 12"
30
30
  },
31
31
  "devDependencies": {
32
- "@types/qs": "6.9.12",
33
- "next": "14.1.2"
32
+ "@types/qs": "6.9.15",
33
+ "next": "14.2.6"
34
34
  }
35
35
  }
package/router.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createRouter = void 0;
3
+ exports.createRouter = createRouter;
4
+ const empty_object_1 = require("@uxf/core/constants/empty-object");
4
5
  const router_1 = require("next/router");
5
6
  const qs_1 = require("qs");
6
7
  const sitemap_generator_1 = require("./sitemap-generator");
@@ -18,7 +19,7 @@ function createRouter(routes) {
18
19
  }
19
20
  const restParams = {};
20
21
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
21
- Object.keys(params !== null && params !== void 0 ? params : {}).forEach((key) => {
22
+ Object.keys(params !== null && params !== void 0 ? params : empty_object_1.EMPTY_OBJECT).forEach((key) => {
22
23
  const value = params[key];
23
24
  const segment = `[${key}]`;
24
25
  const catchAllSegments = `[...${key}]`;
@@ -75,4 +76,3 @@ function createRouter(routes) {
75
76
  useQueryParams: () => (0, router_1.useRouter)().query,
76
77
  };
77
78
  }
78
- exports.createRouter = createRouter;
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.objectToXml = void 0;
3
+ exports.objectToXml = objectToXml;
4
4
  function objectToXml(object) {
5
5
  return Object.entries(object)
6
6
  .filter(([, value]) => value !== null && value !== undefined)
7
7
  .map(([key, value]) => ` <${key}>${value}</${key}>`)
8
8
  .join("\n");
9
9
  }
10
- exports.objectToXml = objectToXml;