@rzl-zone/utils-js 3.7.0 → 3.8.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.
Files changed (118) hide show
  1. package/README.md +23 -0
  2. package/dist/assertions/index.cjs +1 -1
  3. package/dist/assertions/index.d.ts +8 -8
  4. package/dist/assertions/index.js +1 -1
  5. package/dist/chunk-2VO2CBTU.js +1 -1
  6. package/dist/{chunk-KTQLDIIT.cjs → chunk-3JD53UUH.cjs} +15 -5
  7. package/dist/chunk-3KTD3QDI.js +1 -1
  8. package/dist/chunk-4ACKNPL5.js +1 -1
  9. package/dist/chunk-4ZOXSUXB.js +1 -1
  10. package/dist/{chunk-6PKW4WCT.js → chunk-5IKZ3JDV.js} +20 -8
  11. package/dist/chunk-5NN4ZDE2.cjs +1 -1
  12. package/dist/{chunk-OS5OT5JA.cjs → chunk-5PF7KRCP.cjs} +25 -9
  13. package/dist/{chunk-66WLOZOD.cjs → chunk-6NORJBI6.cjs} +7 -5
  14. package/dist/chunk-6RFNZ2ZZ.cjs +1 -1
  15. package/dist/{chunk-TDPYR5JY.js → chunk-6VA4F6VR.js} +15 -5
  16. package/dist/chunk-6WMB5AJR.js +1 -1
  17. package/dist/chunk-7QQV66RX.cjs +1 -1
  18. package/dist/chunk-7WBMA2VE.cjs +1 -1
  19. package/dist/chunk-7ZNEUWYP.js +1 -1
  20. package/dist/chunk-A3YI6Y2P.js +1 -1
  21. package/dist/{chunk-RMJC3B5P.cjs → chunk-A4H7474O.cjs} +7 -4
  22. package/dist/chunk-AKKM6MOX.cjs +1 -1
  23. package/dist/chunk-ATLFMKAF.cjs +1 -1
  24. package/dist/chunk-B4SDEBN7.cjs +1 -1
  25. package/dist/chunk-B6UIKBHR.cjs +1 -1
  26. package/dist/chunk-BAV5T2E3.cjs +1 -1
  27. package/dist/chunk-BYUT376O.cjs +1 -1
  28. package/dist/chunk-CKUEZF4R.cjs +1 -1
  29. package/dist/chunk-DPLL67OT.js +1 -1
  30. package/dist/chunk-DVMHRLKP.cjs +1 -1
  31. package/dist/chunk-EK7FSI7F.cjs +1 -1
  32. package/dist/chunk-F3WBQKRI.cjs +1 -1
  33. package/dist/chunk-FI76UZRF.js +1 -1
  34. package/dist/chunk-GAJBF6DR.js +1 -1
  35. package/dist/{chunk-K3SONK25.cjs → chunk-HKJZ7K2K.cjs} +165 -14
  36. package/dist/{chunk-QUITZ3GP.js → chunk-I3IXLEEG.js} +25 -9
  37. package/dist/{chunk-VNADVWSJ.js → chunk-JIROTDOU.js} +4 -2
  38. package/dist/chunk-JY4HLZ4W.js +1 -1
  39. package/dist/chunk-K63WO3XA.cjs +1 -1
  40. package/dist/chunk-KHO2SBNA.cjs +1 -1
  41. package/dist/chunk-KPCDDYTZ.js +1 -1
  42. package/dist/{chunk-XFTUHS4Y.js → chunk-KVZ3HL2B.js} +7 -5
  43. package/dist/chunk-L5RDAVVH.js +1 -1
  44. package/dist/chunk-LEX4TQW2.js +1 -1
  45. package/dist/chunk-LIU4S3JA.cjs +1 -1
  46. package/dist/{chunk-R3PBF6F7.cjs → chunk-LVFTN6DK.cjs} +29 -17
  47. package/dist/chunk-NREACG6M.cjs +1 -1
  48. package/dist/chunk-OFBFGFVH.js +1 -1
  49. package/dist/chunk-ONZFBJVW.js +1 -1
  50. package/dist/{chunk-D53CE4BT.js → chunk-P3ST4UZA.js} +6 -3
  51. package/dist/{chunk-WNO3EPYT.js → chunk-PW2VMJLT.js} +4 -2
  52. package/dist/chunk-PZQC3FZY.js +1 -1
  53. package/dist/chunk-QAPYHLHC.cjs +1 -1
  54. package/dist/chunk-QNKGP5DY.js +1 -1
  55. package/dist/{chunk-2CQI36UD.cjs → chunk-RJYWBVGD.cjs} +4 -2
  56. package/dist/{chunk-3LEWQV3R.js → chunk-RRJIRXHS.js} +5 -5
  57. package/dist/{chunk-BG3AS5BU.cjs → chunk-SGCN4ED4.cjs} +4 -2
  58. package/dist/chunk-SLP24LUV.js +302 -0
  59. package/dist/chunk-SZJ7OI4S.js +1 -1
  60. package/dist/chunk-TDYGYHSH.js +1 -1
  61. package/dist/chunk-TFDXRT6D.cjs +1 -1
  62. package/dist/chunk-U5VR4TJN.js +1 -1
  63. package/dist/chunk-UDA26MCU.cjs +1 -1
  64. package/dist/chunk-UKAUXY2U.cjs +1 -1
  65. package/dist/chunk-VCVND6CH.js +1 -1
  66. package/dist/chunk-VJDDGRIK.cjs +1 -1
  67. package/dist/chunk-VJVCXEH7.cjs +1 -1
  68. package/dist/chunk-WVSPXFTY.js +1 -1
  69. package/dist/chunk-YC7AK3KX.cjs +1 -1
  70. package/dist/chunk-YGB2BQPB.cjs +1 -1
  71. package/dist/chunk-YS27V6LS.js +1 -1
  72. package/dist/chunk-YWHHVDT4.js +1 -1
  73. package/dist/chunk-ZN53RM3R.js +1 -1
  74. package/dist/{chunk-KIYALQQF.cjs → chunk-ZW3VYES4.cjs} +5 -5
  75. package/dist/conversions/index.cjs +18 -18
  76. package/dist/conversions/index.d.ts +10 -12
  77. package/dist/conversions/index.js +3 -3
  78. package/dist/events/index.cjs +1 -1
  79. package/dist/events/index.d.ts +9 -9
  80. package/dist/events/index.js +1 -1
  81. package/dist/formatters/index.cjs +12 -12
  82. package/dist/formatters/index.d.ts +19 -24
  83. package/dist/formatters/index.js +2 -2
  84. package/dist/generators/index.cjs +10 -6
  85. package/dist/generators/index.d.ts +155 -26
  86. package/dist/generators/index.js +2 -2
  87. package/dist/index.d.ts +1 -1
  88. package/dist/{isPlainObject-FWmcJF6k.d.ts → isPlainObject-BTPjv6zB.d.ts} +2 -2
  89. package/dist/next/index.cjs +11 -9
  90. package/dist/next/index.d.ts +11 -11
  91. package/dist/next/index.js +5 -3
  92. package/dist/next/server/index.cjs +1 -1
  93. package/dist/next/server/index.d.ts +4 -4
  94. package/dist/next/server/index.js +1 -1
  95. package/dist/operations/index.cjs +6 -6
  96. package/dist/operations/index.d.ts +8 -9
  97. package/dist/operations/index.js +3 -3
  98. package/dist/parsers/index.cjs +1 -1
  99. package/dist/parsers/index.d.ts +1 -1
  100. package/dist/parsers/index.js +1 -1
  101. package/dist/predicates/index.cjs +1 -1
  102. package/dist/predicates/index.d.ts +15 -28
  103. package/dist/predicates/index.js +1 -1
  104. package/dist/promises/index.cjs +4 -4
  105. package/dist/promises/index.d.ts +6 -7
  106. package/dist/promises/index.js +2 -2
  107. package/dist/rzl-utils.global.js +2 -2
  108. package/dist/strings/index.cjs +1 -1
  109. package/dist/strings/index.d.ts +1 -1
  110. package/dist/strings/index.js +1 -1
  111. package/dist/tailwind/index.cjs +10 -10
  112. package/dist/tailwind/index.d.ts +22 -22
  113. package/dist/tailwind/index.js +2 -2
  114. package/dist/urls/index.cjs +9 -9
  115. package/dist/urls/index.d.ts +9 -10
  116. package/dist/urls/index.js +3 -3
  117. package/package.json +1 -1
  118. package/dist/chunk-ABA2ZSBQ.js +0 -152
@@ -2,7 +2,7 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.7.0.
5
+ * Version: 3.8.0.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
@@ -2,7 +2,7 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.7.0.
5
+ * Version: 3.8.0.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
@@ -2,7 +2,7 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.7.0.
5
+ * Version: 3.8.0.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
@@ -2,47 +2,47 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.7.0.
5
+ * Version: 3.8.0.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
9
9
  */
10
10
  'use strict';
11
11
 
12
- var chunkKIYALQQF_cjs = require('../chunk-KIYALQQF.cjs');
12
+ var chunkZW3VYES4_cjs = require('../chunk-ZW3VYES4.cjs');
13
13
  require('../chunk-NREACG6M.cjs');
14
14
  require('../chunk-7WBMA2VE.cjs');
15
15
  require('../chunk-F3WBQKRI.cjs');
16
16
 
17
17
  Object.defineProperty(exports, "cnV3", {
18
18
  enumerable: true,
19
- get: function () { return chunkKIYALQQF_cjs.cnV3; }
19
+ get: function () { return chunkZW3VYES4_cjs.cnV3; }
20
20
  });
21
21
  Object.defineProperty(exports, "cnV4", {
22
22
  enumerable: true,
23
- get: function () { return chunkKIYALQQF_cjs.cnV4; }
23
+ get: function () { return chunkZW3VYES4_cjs.cnV4; }
24
24
  });
25
25
  Object.defineProperty(exports, "customCnV3", {
26
26
  enumerable: true,
27
- get: function () { return chunkKIYALQQF_cjs.customCnV3; }
27
+ get: function () { return chunkZW3VYES4_cjs.customCnV3; }
28
28
  });
29
29
  Object.defineProperty(exports, "customCnV4", {
30
30
  enumerable: true,
31
- get: function () { return chunkKIYALQQF_cjs.customCnV4; }
31
+ get: function () { return chunkZW3VYES4_cjs.customCnV4; }
32
32
  });
33
33
  Object.defineProperty(exports, "cx", {
34
34
  enumerable: true,
35
- get: function () { return chunkKIYALQQF_cjs.cx; }
35
+ get: function () { return chunkZW3VYES4_cjs.cx; }
36
36
  });
37
37
  Object.defineProperty(exports, "shouldForwardProp", {
38
38
  enumerable: true,
39
- get: function () { return chunkKIYALQQF_cjs.shouldForwardProp; }
39
+ get: function () { return chunkZW3VYES4_cjs.shouldForwardProp; }
40
40
  });
41
41
  Object.defineProperty(exports, "twMergeDefaultV3", {
42
42
  enumerable: true,
43
- get: function () { return chunkKIYALQQF_cjs.twMergeDefaultV3; }
43
+ get: function () { return chunkZW3VYES4_cjs.twMergeDefaultV3; }
44
44
  });
45
45
  Object.defineProperty(exports, "twMergeDefaultV4", {
46
46
  enumerable: true,
47
- get: function () { return chunkKIYALQQF_cjs.twMergeDefaultV4; }
47
+ get: function () { return chunkZW3VYES4_cjs.twMergeDefaultV4; }
48
48
  });
@@ -2,7 +2,7 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.7.0.
5
+ * Version: 3.8.0.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
@@ -20,7 +20,7 @@ import{Config}from'tailwindcss';import{ClassNameValue as ClassNameValue$1,Config
20
20
  * - `null | undefined` → ignored
21
21
  * - `ClassObject` → objects where **keys with truthy values** are included
22
22
  * - `ClassValues` → arrays recursively flattened
23
- * - Used internally by **{@link cx | `cx`}** to process mixed input values.
23
+ * - Used internally by ***`cx` utility function*** to process mixed input values.
24
24
  * @example
25
25
  * ```ts
26
26
  * const val1: ClassValue = "button"; // ➔ string
@@ -63,7 +63,15 @@ type ClassValues=ClassValue[];
63
63
  * * ***Utility: `cx`.***
64
64
  * ----------------------------------------------------------
65
65
  * **Merge multiple class values into a single, space-separated string suitable for CSS usage.**
66
- * @param {ClassValues} args
66
+ * @description
67
+ * - Supports **nested combinations** of arrays and objects, recursively.
68
+ * - **Falsy values** are skipped:
69
+ * - `false`, `null`, `undefined`, empty strings `""` are ignored anywhere.
70
+ * - Numbers `0` are ignored inside nested arrays/objects.
71
+ * - **Boxed primitives** are correctly unwrapped to their primitive value.
72
+ * - **Inherited object keys** are included in the final class string.
73
+ * - Optimized for **CSS class merging** where conditional inclusion is common.
74
+ * @param {ClassValues} values
67
75
  * A list of mixed class values, which can include:
68
76
  * - **Strings** → literal class names.
69
77
  * - **Numbers** → numeric class names.
@@ -74,14 +82,6 @@ type ClassValues=ClassValue[];
74
82
  * - **Falsy values** (`false`, `null`, `undefined`, `""`, `0`) are ignored according to original behavior.
75
83
  * @returns {string}
76
84
  * A single space-separated string containing all valid class names.
77
- * @description
78
- * - Supports **nested combinations** of arrays and objects, recursively.
79
- * - **Falsy values** are skipped:
80
- * - `false`, `null`, `undefined`, empty strings `""` are ignored anywhere.
81
- * - Numbers `0` are ignored inside nested arrays/objects.
82
- * - **Boxed primitives** are correctly unwrapped to their primitive value.
83
- * - **Inherited object keys** are included in the final class string.
84
- * - Optimized for **CSS class merging** where conditional inclusion is common.
85
85
  * @example
86
86
  * ```ts
87
87
  * // Basic string merge
@@ -112,7 +112,7 @@ type ClassValues=ClassValue[];
112
112
  * // ➔ "own inherited"
113
113
  * ```
114
114
  */
115
- declare function cx(...args:ClassValues):string;
115
+ declare function cx(...values:ClassValues):string;
116
116
  /** -------------------------------------------------------------
117
117
  * * ***Default `cnV3` utility (Tailwind v3).***
118
118
  * -------------------------------------------------------------
@@ -497,8 +497,8 @@ declare const customCnV4:(customTwMergeV4:TwMergeDefaultFnV4,...classes:ClassVal
497
497
  * - `true` ➔ the prop **will** be forwarded to the DOM.
498
498
  * - `false` ➔ the prop **will not** be forwarded.
499
499
  *
500
- * @throws {TypeError}
501
- * Thrown when:
500
+ * @throws **{@link TypeError | `TypeError`}**
501
+ * when:
502
502
  * - `props` is not an array, or
503
503
  * - any item is not a non-empty string.
504
504
  *
@@ -523,8 +523,8 @@ declare const shouldForwardProp:<CustomProps extends Record<string,unknown>>(pro
523
523
  /** -------------------------------------------------------------
524
524
  * * ***Customized Tailwind class merger Version 3 with extended rules.***
525
525
  * -------------------------------------------------------------
526
- * **Wraps **{@link extendTailwindMerge| `extendTailwindMerge`}** with Tailwind’s default config
527
- * ({@link getDefaultConfig | `getDefaultConfig()`}) to create a **project-ready `twMerge`**.**
526
+ * **Wraps ***`extendTailwindMerge` from tailwind-merge-v3*** with Tailwind’s default
527
+ * config (_*`getDefaultConfig()` from tailwind-merge-v3*_) to create a **project-ready `twMerge`**.**
528
528
  * - 🔑 **When to use it?**
529
529
  * - Your project uses **Tailwind v3**.
530
530
  * - Extend **class groups** (e.g. add `text-shadow`).
@@ -576,7 +576,7 @@ declare const shouldForwardProp:<CustomProps extends Record<string,unknown>>(pro
576
576
  * #### Example 4: ***Project-wide helper (recommended).***
577
577
  * ```ts
578
578
  * import configTwCss from "../tailwind.config";
579
- * import { customCnV3, twMergeDefaultV3, type ClassesValue } from "@rzl-zone/utils-js/tailwind";
579
+ * import { customCnV3, twMergeDefaultV3, type ClassValues } from "@rzl-zone/utils-js/tailwind";
580
580
  *
581
581
  * const customTwMerge = twMergeDefaultV3({
582
582
  * config: configTwCss,
@@ -585,7 +585,7 @@ declare const shouldForwardProp:<CustomProps extends Record<string,unknown>>(pro
585
585
  * },
586
586
  * });
587
587
  *
588
- * export const cnApp = (...classes: ClassesValue) => {
588
+ * export const cnApp = (...classes: ClassValues) => {
589
589
  * return customCnV3(customTwMerge, ...classes);
590
590
  * };
591
591
  *
@@ -610,8 +610,8 @@ declare const twMergeDefaultV3:(options?:OptionsMergeTwClsV3)=>TwMergeDefaultFnV
610
610
  /** -------------------------------------------------------------
611
611
  * * ***Customized Tailwind class merger Version 4 with extended rules.***
612
612
  * -------------------------------------------------------------
613
- * **Wraps **{@link extendTailwindMerge| `extendTailwindMerge`}** with Tailwind’s default config
614
- * ({@link getDefaultConfig | `getDefaultConfig()`}) to create a **project-ready `twMerge`**.**
613
+ * **Wraps ***`extendTailwindMerge` from tailwind-merge-v4*** with Tailwind’s default
614
+ * config (_*`getDefaultConfig()` from tailwind-merge-v4*_) to create a **project-ready `twMerge`**.**
615
615
  * - 🔑 **When to use it?**
616
616
  * - Your project uses **Tailwind v4**.
617
617
  * - Extend **class groups** (e.g. add `text-shadow`).
@@ -663,7 +663,7 @@ declare const twMergeDefaultV3:(options?:OptionsMergeTwClsV3)=>TwMergeDefaultFnV
663
663
  * #### Example 4: ***Project-wide helper (recommended).***
664
664
  * ```ts
665
665
  * import configTwCss from "../tailwind.config";
666
- * import { customCnV4, twMergeDefaultV4, type ClassesValue } from "@rzl-zone/utils-js/tailwind";
666
+ * import { customCnV4, twMergeDefaultV4, type ClassValues } from "@rzl-zone/utils-js/tailwind";
667
667
  *
668
668
  * const customTwMerge = twMergeDefaultV4({
669
669
  * config: configTwCss,
@@ -672,7 +672,7 @@ declare const twMergeDefaultV3:(options?:OptionsMergeTwClsV3)=>TwMergeDefaultFnV
672
672
  * },
673
673
  * });
674
674
  *
675
- * export const cnApp = (...classes: ClassesValue) => {
675
+ * export const cnApp = (...classes: ClassValues) => {
676
676
  * return customCnV4(customTwMerge, ...classes);
677
677
  * };
678
678
  *
@@ -2,12 +2,12 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.7.0.
5
+ * Version: 3.8.0.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
9
9
  */
10
- export { cnV3, cnV4, customCnV3, customCnV4, cx, shouldForwardProp, twMergeDefaultV3, twMergeDefaultV4 } from '../chunk-3LEWQV3R.js';
10
+ export { cnV3, cnV4, customCnV3, customCnV4, cx, shouldForwardProp, twMergeDefaultV3, twMergeDefaultV4 } from '../chunk-RRJIRXHS.js';
11
11
  import '../chunk-JY4HLZ4W.js';
12
12
  import '../chunk-6WMB5AJR.js';
13
13
  import '../chunk-3KTD3QDI.js';
@@ -2,21 +2,21 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.7.0.
5
+ * Version: 3.8.0.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
9
9
  */
10
10
  'use strict';
11
11
 
12
- var chunkR3PBF6F7_cjs = require('../chunk-R3PBF6F7.cjs');
12
+ var chunkLVFTN6DK_cjs = require('../chunk-LVFTN6DK.cjs');
13
13
  require('../chunk-KHO2SBNA.cjs');
14
14
  require('../chunk-BYUT376O.cjs');
15
15
  require('../chunk-AKKM6MOX.cjs');
16
16
  require('../chunk-UKAUXY2U.cjs');
17
17
  require('../chunk-B4SDEBN7.cjs');
18
18
  require('../chunk-DVMHRLKP.cjs');
19
- var chunkBG3AS5BU_cjs = require('../chunk-BG3AS5BU.cjs');
19
+ var chunkSGCN4ED4_cjs = require('../chunk-SGCN4ED4.cjs');
20
20
  var chunkVJVCXEH7_cjs = require('../chunk-VJVCXEH7.cjs');
21
21
  require('../chunk-LIU4S3JA.cjs');
22
22
  require('../chunk-NREACG6M.cjs');
@@ -28,27 +28,27 @@ require('../chunk-F3WBQKRI.cjs');
28
28
 
29
29
  Object.defineProperty(exports, "constructURL", {
30
30
  enumerable: true,
31
- get: function () { return chunkR3PBF6F7_cjs.constructURL; }
31
+ get: function () { return chunkLVFTN6DK_cjs.constructURL; }
32
32
  });
33
33
  Object.defineProperty(exports, "extractURLs", {
34
34
  enumerable: true,
35
- get: function () { return chunkR3PBF6F7_cjs.extractURLs; }
35
+ get: function () { return chunkLVFTN6DK_cjs.extractURLs; }
36
36
  });
37
37
  Object.defineProperty(exports, "getFirstPrefixPathname", {
38
38
  enumerable: true,
39
- get: function () { return chunkR3PBF6F7_cjs.getFirstPrefixPathname; }
39
+ get: function () { return chunkLVFTN6DK_cjs.getFirstPrefixPathname; }
40
40
  });
41
41
  Object.defineProperty(exports, "getPrefixPathname", {
42
42
  enumerable: true,
43
- get: function () { return chunkR3PBF6F7_cjs.getPrefixPathname; }
43
+ get: function () { return chunkLVFTN6DK_cjs.getPrefixPathname; }
44
44
  });
45
45
  Object.defineProperty(exports, "formatEnvPort", {
46
46
  enumerable: true,
47
- get: function () { return chunkBG3AS5BU_cjs.formatEnvPort; }
47
+ get: function () { return chunkSGCN4ED4_cjs.formatEnvPort; }
48
48
  });
49
49
  Object.defineProperty(exports, "normalizePathname", {
50
50
  enumerable: true,
51
- get: function () { return chunkBG3AS5BU_cjs.normalizePathname; }
51
+ get: function () { return chunkSGCN4ED4_cjs.normalizePathname; }
52
52
  });
53
53
  Object.defineProperty(exports, "punycodeUtilsJS", {
54
54
  enumerable: true,
@@ -2,7 +2,7 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.7.0.
5
+ * Version: 3.8.0.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
@@ -12,7 +12,7 @@
12
12
  * ----------------------------------------------------------
13
13
  * **Represents a non-empty array of key–value pairs.**
14
14
  * @description
15
- * Type for `queryParams` parameter, the second parameter of **{@link constructURL | `constructURL`}**.
15
+ * Type for `queryParams` parameter, the second parameter of ***`constructURL` utility function***.
16
16
  * - **Behavior:**
17
17
  * - Each inner tuple strictly follows the `[string, string | number]` shape.
18
18
  * - Ensures the outer array contains **at least one pair** (non-empty).
@@ -44,7 +44,7 @@ type QueryParamPairs=[[string,string|number],...[string,string|number][]];
44
44
  * @param {string[]} [removeParams]
45
45
  * A list of query parameter keys to remove from the final URL, whether they were in the base URL or provided queryParams.
46
46
  * @returns {URL} A new URL object representing the constructed URL with merged and cleaned query parameters.
47
- * @throws {TypeError} Throws if `baseUrl` is not a valid non-empty string or URL object, or if `queryParams` is not iterable, or if `removeParams` is not an array of strings.
47
+ * @throws **{@link TypeError | `TypeError`}** if `baseUrl` is not a valid non-empty string or URL object, or if `queryParams` is not iterable, or if `removeParams` is not an array of strings.
48
48
  * @example
49
49
  * 1. #### Basic Usage:
50
50
  * ```ts
@@ -202,8 +202,7 @@ declare const extractURLs:(url:string|null|undefined)=>string[]|null;
202
202
  * - Defaults to `"/"`.
203
203
  * @returns {string}
204
204
  * ***The first valid normalized pathname, or the normalized default.***
205
- * @throws {TypeError}
206
- * ***If `result` is not a valid type, or `defaultValue` is not a string or empty-string.***
205
+ * @throws **{@link TypeError | `TypeError`}** ***if `result` is not a valid type, or `defaultValue` is not a string or empty-string.***
207
206
  */
208
207
  declare const getFirstPrefixPathname:(result:string|string[]|null|undefined,defaultValue?:string)=>string;type GetPrefixPathnameOptions={
209
208
  /** The number of levels to include in the prefix (default is `1`).
@@ -252,8 +251,8 @@ removeDuplicates?:boolean;};
252
251
  * - A single string if only one unique prefix/base is found.
253
252
  * - An array of strings if multiple different prefixes/bases are found.
254
253
  * - `null` if no matching base is found when using `base`.
255
- * @throws {TypeError}
256
- * ***Throws if:***
254
+ * @throws **{@link TypeError | `TypeError`}**
255
+ * ***if:***
257
256
  * - `url` is `not a string` or `not an array of strings`.
258
257
  * - `base` is `not a string`, `array of strings`, or `null`.
259
258
  * - `options` is `not an object`.
@@ -429,8 +428,8 @@ keepTrailingSlash?:boolean;};type NormalizePathnameOptionsKeepNullableTrue=MainN
429
428
  * @returns {string | null | undefined} ***Normalized pathname, or original nullable value if `keepNullable` is `true`
430
429
  * _(except if `pathname` is empty-string, will keep returning `defaultPath`)_.***
431
430
  *
432
- * @throws {TypeError} If `defaultPath` is invalid when `keepNullable` is false.
433
- * @throws {NormalizePathnameError} If normalization fails (e.g., invalid URL).
431
+ * @throws **{@link TypeError | `TypeError`}** if `defaultPath` is invalid when `keepNullable` is false.
432
+ * @throws **`NormalizePathnameError` extends {@link Error | `Error`}** If normalization fails (e.g., invalid URL).
434
433
  *
435
434
  * @example
436
435
  * // Basic normalization
@@ -550,7 +549,7 @@ prefixColon?:boolean;};
550
549
  * @param {string | null | undefined} envVar The environment variable string.
551
550
  * @param {FormatEnvPortOptions} [options] Optional object: `{ prefixColon?: boolean }`.
552
551
  * @returns {string} A string like `":8080"` or `"8080"`, or `""` if no digits.
553
- * @throws {TypeError} If `options` is not an object or `prefixColon` is not boolean.
552
+ * @throws **{@link TypeError | `TypeError`}** if `options` is not an object or `prefixColon` is not boolean.
554
553
  * @example
555
554
  * formatEnvPort("port:8080");
556
555
  * // ➔ "8080"
@@ -2,19 +2,19 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.7.0.
5
+ * Version: 3.8.0.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
9
9
  */
10
- export { constructURL, extractURLs, getFirstPrefixPathname, getPrefixPathname } from '../chunk-6PKW4WCT.js';
10
+ export { constructURL, extractURLs, getFirstPrefixPathname, getPrefixPathname } from '../chunk-5IKZ3JDV.js';
11
11
  import '../chunk-ONZFBJVW.js';
12
12
  import '../chunk-GAJBF6DR.js';
13
13
  import '../chunk-TDYGYHSH.js';
14
14
  import '../chunk-PZQC3FZY.js';
15
15
  import '../chunk-7ZNEUWYP.js';
16
16
  import '../chunk-WVSPXFTY.js';
17
- export { formatEnvPort, normalizePathname } from '../chunk-WNO3EPYT.js';
17
+ export { formatEnvPort, normalizePathname } from '../chunk-PW2VMJLT.js';
18
18
  export { punycodeUtilsJS } from '../chunk-YS27V6LS.js';
19
19
  import '../chunk-4ACKNPL5.js';
20
20
  import '../chunk-JY4HLZ4W.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rzl-zone/utils-js",
3
- "version": "3.7.0",
3
+ "version": "3.8.0",
4
4
  "sideEffects": false,
5
5
  "engineStrict": true,
6
6
  "license": "MIT",
@@ -1,152 +0,0 @@
1
- /*!
2
- * ====================================================
3
- * Rzl Utils-JS.
4
- * ----------------------------------------------------
5
- * Version: 3.7.0.
6
- * Author: Rizalvin Dwiky.
7
- * Repository: https://github.com/rzl-zone/utils-js.
8
- * ====================================================
9
- */
10
- import { isInteger } from './chunk-WVSPXFTY.js';
11
- import { safeStableStringify } from './chunk-2VO2CBTU.js';
12
- import { isNonEmptyArray, getPreciseType, isNumber, isPlainObject, assertIsBoolean, isNaN } from './chunk-3KTD3QDI.js';
13
-
14
- function getRandomItem(array) {
15
- if (!isNonEmptyArray(array)) return void 0;
16
- const randomIndex = Math.floor(Math.random() * (array.length || 0));
17
- return array[randomIndex];
18
- }
19
-
20
- var randomInt = (min, max) => {
21
- if (!isInteger(min) || !isInteger(max)) {
22
- throw new TypeError(
23
- `First parameter (\`min\`) and second parameter (\`max\`) must be of type \`integer-number\`${minValueNote(
24
- min,
25
- max
26
- )}value, but received: ['min': \`${getPreciseType(
27
- min
28
- )}\` - (with value: \`${safeStableStringify(min)})\`, 'max': \`${getPreciseType(
29
- max
30
- )}\` - (with value: \`${safeStableStringify(max)}\`)].`
31
- );
32
- }
33
- if (min > max) {
34
- throw new RangeError(
35
- `First parameter (\`min\`) must be less than or equal to second parameter (\`max\`), but received: ['min': ${formatValue(
36
- min
37
- )}, 'max': ${formatValue(max)}].`
38
- );
39
- }
40
- min = Math.max(1, min);
41
- max = Math.min(Number.MAX_SAFE_INTEGER, max);
42
- return Math.floor(Math.random() * (max - min + 1)) + min;
43
- };
44
- var formatValue = (value) => {
45
- return isNumber(value, { includeNaN: true }) ? value === Number.MIN_VALUE ? "`Number.MIN_VALUE`" : `${value}` : `\`${getPreciseType(value)}\``;
46
- };
47
- var minValueNote = (...values) => {
48
- return values.some((v) => isNumber(v, { includeNaN: true }) && v === Number.MIN_VALUE) ? " and can't be `Number.MIN_VALUE` " : " ";
49
- };
50
-
51
- var randomIntByLength = (options) => {
52
- if (!isPlainObject(options)) {
53
- options = {};
54
- }
55
- const { minLength = 1, maxLength = 16, avoidZero = false } = options;
56
- assertIsBoolean(avoidZero, {
57
- message({ currentType, validType }) {
58
- return `Parameters \`avoidZero\` must be of type \`${validType}\`, but received: \`${currentType}\`.`;
59
- }
60
- });
61
- if (!isInteger(minLength) || !isInteger(maxLength)) {
62
- throw new TypeError(
63
- `Parameters \`minLength\` and \`maxLength\` must be of type \`integer-number\`, but received: ['minLength': \`${getPreciseType(
64
- minLength
65
- )}\` - (with value: ${safeStableStringify(
66
- minLength
67
- )}), 'maxLength': \`${getPreciseType(
68
- maxLength
69
- )}\` - (with value: ${safeStableStringify(maxLength)})].`
70
- );
71
- }
72
- if (minLength < 1 || maxLength > 16 || minLength > maxLength) {
73
- throw new RangeError(
74
- `Invalid range at parameters \`minLength\` must be \u2265 1, \`maxLength\` must be \u2264 16, and \`minLength\` \u2264 \`maxLength\`, but received: ['minLength': \`${minLength}\`, 'maxLength': \`${maxLength}\`].`
75
- );
76
- }
77
- const randomLength = minLength === maxLength ? minLength : randomInt(minLength, maxLength);
78
- const minValue = 10 ** (randomLength - 1);
79
- const maxValue = 10 ** randomLength - 1;
80
- let result = randomInt(minValue, maxValue);
81
- if (avoidZero && result === 0) {
82
- result = minValue;
83
- }
84
- return result;
85
- };
86
-
87
- var randomStr = (options) => {
88
- if (!isPlainObject(options)) {
89
- options = {};
90
- }
91
- const {
92
- minLength = 40,
93
- maxLength = 40,
94
- type = "string",
95
- avoidWhiteSpace = true
96
- } = options;
97
- assertIsBoolean(avoidWhiteSpace, {
98
- message({ currentType, validType }) {
99
- return `Parameters \`avoidWhiteSpace\` property of the \`options\` (first-parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`;
100
- }
101
- });
102
- if (!isInteger(minLength) || !isInteger(maxLength)) {
103
- throw new TypeError(
104
- `Parameters \`minLength\` and \`maxLength\` must be of type \`integer-number\`, but received: ['minLength': \`${getPreciseType(
105
- minLength
106
- )}\` - (with value: ${safeStableStringify(
107
- minLength
108
- )}), 'maxLength': \`${getPreciseType(
109
- maxLength
110
- )}\` - (with value: ${safeStableStringify(maxLength)})].`
111
- );
112
- }
113
- if (minLength < 1 || maxLength > 5e3 || minLength > maxLength) {
114
- throw new RangeError(
115
- `Invalid range at parameters \`minLength\` must be \u2265 1, \`maxLength\` must be \u2264 5000, and \`minLength\` \u2264 \`maxLength\`, but received: ['minLength': \`${minLength}\`, 'maxLength': \`${maxLength}\`].`
116
- );
117
- }
118
- if (type !== "string" && type !== "number") {
119
- throw new TypeError(
120
- `Parameter \`type\` must be of type \`string\` with value one of "string" | "number", but received: \`${getPreciseType(
121
- type
122
- )}\`, with value: ${safeStableStringify(type)}.`
123
- );
124
- }
125
- const length = randomInt(minLength, maxLength);
126
- const cleanCharacters = (charSet) => {
127
- return avoidWhiteSpace ? charSet.replace(/\s|\n|\t/g, "") : charSet;
128
- };
129
- const defaultNumberSet = "0123456789";
130
- const defaultStringSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
131
- const baseCharSet = type === "number" ? (!isNaN(Number(options.replaceGenInt)) ? options.replaceGenInt : void 0) ?? defaultNumberSet : (options.replaceGenStr ? options.replaceGenStr : void 0) ?? defaultStringSet;
132
- const characterSet = cleanCharacters(baseCharSet) + (options.addChar || "");
133
- if (!characterSet.length) {
134
- const errCharSet = () => {
135
- if (type === "number") {
136
- if (avoidWhiteSpace) {
137
- return `If \`avoidWhiteSpace\` is true, and \`replaceGenInt\` cant be empty-string value, ensure \`replaceGenInt\` has valid characters and non-nan string number.`;
138
- }
139
- return `Ensure \`replaceGenInt\` has valid characters and not a NaN number string while convert to number.`;
140
- }
141
- return `Ensure \`replaceGenStr\` has valid characters and non empty string.`;
142
- };
143
- throw new Error(`Character set is empty. ${errCharSet()}`);
144
- }
145
- let result = "";
146
- for (let i = 0; i < length; i++) {
147
- result += characterSet.charAt(Math.floor(Math.random() * characterSet.length));
148
- }
149
- return result;
150
- };
151
-
152
- export { getRandomItem, randomInt, randomIntByLength, randomStr };