@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
  * ====================================================
@@ -39,7 +39,7 @@ import{NullToUndefined,FixNeverArrayRecursive,IfNonEmptyArray,Extends}from'@rzl-
39
39
  * const tuple = [1, "two", true] as const;
40
40
  * getRandomItem(tuple); // 1 | "two" | true
41
41
  */
42
- declare function getRandomItem(array:undefined):undefined;declare function getRandomItem(array:null):undefined;declare function getRandomItem(array:[]):undefined;declare function getRandomItem<T extends readonly unknown[]>(array:T):T extends never[][]?[]:number extends T["length"]?NullToUndefined<FixNeverArrayRecursive<T[number]>>:IfNonEmptyArray<T,NullToUndefined<FixNeverArrayRecursive<T[number]>>,undefined>;declare function getRandomItem<T extends readonly unknown[]|undefined|null>(array:T):T extends readonly unknown[]?NullToUndefined<FixNeverArrayRecursive<T[number]>>|undefined:undefined;declare function getRandomItem<T>(array:T):unknown extends T?unknown:Extends<any[]|readonly any[],T>extends true?Extract<T,unknown[]|readonly unknown[]>[number]|undefined:Extends<any[],T>extends true?Extract<T,unknown[]|readonly unknown[]>[number]|undefined:Extends<readonly any[],T>extends true?Extract<T,unknown[]|readonly unknown[]>[number]|undefined:undefined;
42
+ declare function getRandomItem(array:undefined):undefined;declare function getRandomItem(array:[]):undefined;declare function getRandomItem<T extends readonly unknown[]>(array:T):T extends never[][]?undefined:number extends T["length"]?NullToUndefined<FixNeverArrayRecursive<T[number]>>:IfNonEmptyArray<T,NullToUndefined<FixNeverArrayRecursive<T[number]>>,undefined>;declare function getRandomItem<T extends readonly unknown[]|undefined|null>(array:T):T extends readonly unknown[]?NullToUndefined<FixNeverArrayRecursive<T[number]>>|undefined:undefined;declare function getRandomItem<T>(array:T):unknown extends T?unknown:Extends<any[]|readonly any[],T>extends true?Extract<T,unknown[]|readonly unknown[]>[number]|undefined:Extends<any[],T>extends true?Extract<T,unknown[]|readonly unknown[]>[number]|undefined:Extends<readonly any[],T>extends true?Extract<T,unknown[]|readonly unknown[]>[number]|undefined:undefined;
43
43
  /** -----------------------------------------------------------------------
44
44
  * * ***Utility: `randomInt`.***
45
45
  * ------------------------------------------------------------------------
@@ -50,14 +50,14 @@ declare function getRandomItem(array:undefined):undefined;declare function getRa
50
50
  * @param {number} min - The minimum value (inclusive), must be an integer.
51
51
  * @param {number} max - The maximum value (inclusive), must be an integer.
52
52
  * @returns {number} A random integer N where `min ≤ N ≤ max`.
53
- * @throws {TypeError} If:
54
- * - `min` or `max` is not an integer and value is `Number.MIN_VALUE`.
53
+ * @throws **{@link TypeError | `TypeError`}** if:
54
+ * - `min` or `max` is not an integer, or value is `Number.MIN_VALUE`.
55
55
  * - `min` is greater than `max`.
56
56
  * @example
57
- * randomInt(1, 10); // ➔ returns 1 to 10
58
- * randomInt(50, 100); // ➔ returns 50 to 100
59
- * randomInt(5, 5); // ➔ always returns 5
60
- * randomInt(-5, 3); // ➔ always returns ≥ 1, since min is adjusted
57
+ * randomInt(1, 10); // ➔ returns 1 up-to 10 (random)
58
+ * randomInt(50, 100); // ➔ returns 50 up-to 100 (random)
59
+ * randomInt(5, 5); // ➔ always returns 5 (exact)
60
+ * randomInt(-5, 3); // ➔ always returns ≥ 1, since min is adjusted (exact)
61
61
  * randomInt(1, Number.MAX_SAFE_INTEGER + 10000);
62
62
  * // ➔ still safely capped at MAX_SAFE_INTEGER
63
63
  * randomInt(Number.MIN_VALUE, 3);
@@ -96,14 +96,14 @@ avoidZero?:boolean;};
96
96
  * @param {OptionsRandomIntByLength["maxLength"]} [options.maxLength=16] - Maximum number of digits (must be ≤ `16`).
97
97
  * @param {OptionsRandomIntByLength["avoidZero"]} [options.avoidZero=false] - If true, will ensure the result is never zero.
98
98
  * @returns {number} A randomly generated integer within the specified constraints.
99
- * @throws {TypeError} If parameters are invalid, such as:
99
+ * @throws **{@link TypeError | `TypeError`}** if parameters are invalid, such as:
100
100
  * - `minLength` < `1`
101
101
  * - `maxLength` > `16`
102
102
  * - `minLength` > `maxLength`
103
103
  * - non-integer values for `minLength` or `maxLength`
104
104
  * @example
105
105
  * randomIntByLength({ minLength: 3, maxLength: 5 });
106
- * // ➔ (`4829` << random), (`192` << random) or (`71492` << random).
106
+ * // ➔ `4829` (random), `192` (random) or `71492` (random).
107
107
  * randomIntByLength({ minLength: 4, maxLength: 4 });
108
108
  * // ➔ `5930` (exact 4 digits)
109
109
  * randomIntByLength({ avoidZero: true });
@@ -155,7 +155,7 @@ type?:"string"|"number";};
155
155
  * @param {OptionsRandomStr["replaceGenInt"]} [options.replaceGenInt] - A custom character set to use when `type` is `"number"`.
156
156
  * @param {OptionsRandomStr["addChar"]} [options.addChar] - Additional characters to always include in the character set.
157
157
  * @returns {string} The randomly generated string or numeric string of the desired length.
158
- * @throws {TypeError} If provided options are invalid (such as minLength > maxLength, invalid type, or empty character set).
158
+ * @throws **{@link TypeError | `TypeError`}** if provided options are invalid (such as minLength > maxLength, invalid type, or empty character set).
159
159
  * @example
160
160
  * randomStr();
161
161
  * // ➔ Generates a 40-character random alphanumeric string
@@ -169,25 +169,154 @@ type?:"string"|"number";};
169
169
  * // ➔ Guaranteed to include !@# in the set
170
170
  */
171
171
  declare const randomStr:(options?:OptionsRandomStr)=>string;
172
- /** --------------------------------------------------
172
+ /**
173
+ * Configuration options for `randomUUID()`.
174
+ */
175
+ type OptionsRandomUUID={
176
+ /**
177
+ * Specifies which UUID version to generate.
178
+ *
179
+ * - `"v4"` — Fully random UUID (RFC 4122). No timestamp, no ordering guarantees.
180
+ * - `"v7"` — Time-ordered UUID (RFC 9562). Uses Unix timestamp + randomness.
181
+ *
182
+ * @default "v4"
183
+ *
184
+ * @example
185
+ * // Random v4 UUID
186
+ * randomUUID({ version: "v4" }); // ➔ "3ec0de5a-b8a9-4ffb-a62a-fcc76851e9c2"
187
+ *
188
+ * @example
189
+ * // Time-ordered v7 UUID
190
+ * randomUUID({ version: "v7" }); // ➔ "0199f3f6-3c5e-744b-affa-46b2cfd496f8"
191
+ */
192
+ version?:"v4"|"v7";
193
+ /**
194
+ * Enables monotonic sequencing for UUID v7.
195
+ *
196
+ * - Guarantees that multiple UUIDs generated within the same millisecond
197
+ * are strictly non-decreasing (lexicographically and timestamp-wise).
198
+ * - Only valid when `version === "v7"`. Using with `v4` will throw a `TypeError`.
199
+ * - Useful for database inserts, logs, or any system where order matters.
200
+ *
201
+ * @default false
202
+ *
203
+ * @example
204
+ * // Monotonic v7 UUIDs
205
+ * const a = randomUUID({ version: "v7", monotonic: true });
206
+ * const b = randomUUID({ version: "v7", monotonic: true });
207
+ * console.log(a < b); // true, guaranteed
208
+ */
209
+ monotonic?:boolean;};
210
+ /** -----------------------------------------------------------------------
211
+ * * ***Utility: `randomUUID`.***
212
+ * ------------------------------------------------------------------------
213
+ * **Generates a UUID string according to the specified version and options.**
214
+ *
215
+ * - **Supported versions**:
216
+ * - **`"v4"` (default)** ➔ Fully random UUID, RFC 4122 compliant.
217
+ * - Uses `crypto.randomUUID()` if available.
218
+ * - Falls back to `crypto.getRandomValues()` or `Math.random()`
219
+ * if needed.
220
+ * - **`"v7"`** ➔ Time-ordered UUID, RFC 9562 compliant.
221
+ * - Timestamp (Unix ms, 48 bits) + 80 bits randomness.
222
+ * - Good for database indexing / sorting.
223
+ * - **`"v7"` + `monotonic: true`** ➔ Ensures strictly non-decreasing UUIDs
224
+ * for multiple calls in the same millisecond (per-process).
225
+ *
226
+ * - **Behavior / Safety Notes**:
227
+ * - **v4**: Fully random; probability of duplicates is astronomically low.
228
+ * - **v7**: Time-ordered; collisions extremely unlikely unless same ms + random repeat.
229
+ * - **Monotonic v7**: Guaranteed ordering per-process if multiple UUIDs are generated
230
+ * in the same millisecond.
231
+ * - **All versions**: Fallback safely if `crypto` APIs are unavailable.
232
+ *
233
+ * @param {object} [options] - Optional settings object.
234
+ * @param {"v4" | "v7"} [options.version="v4"] - UUID version to generate.
235
+ * @param {boolean} [options.monotonic=false] - For v7 only: generate monotonic UUIDs
236
+ * to maintain strict lexicographic order
237
+ * when generating multiple UUIDs within the same ms.
238
+ *
239
+ * @returns {string} A 36-character UUID string compliant with the selected version.
240
+ *
241
+ * @throws **{@link TypeError | `TypeError`}** if:
242
+ * - `options` is not a plain object.
243
+ * - `options.version` is provided but not a string.
244
+ * - `options.monotonic` is provided but not a boolean.
245
+ * - `monotonic: true` is used with `version` other than `"v7"`.
246
+ * @throws **{@link RangeError | `RangeError`}** if `options.version` is provided but not `"v4"` or `"v7"`.
247
+ *
248
+ * @example
249
+ * // Default (v4)
250
+ * const id = randomUUID();
251
+ * // ➔ "3b12f1df-5232-4804-897e-917bf397618a"
252
+ *
253
+ * @example
254
+ * // Explicit v4
255
+ * const id4 = randomUUID({ version: "v4" });
256
+ *
257
+ * @example
258
+ * // Time-ordered v7
259
+ * const id7 = randomUUID({ version: "v7" });
260
+ * // ➔ "018f48d2-84c1-7ccd-b5a3-2f9463b3a889"
261
+ *
262
+ * @example
263
+ * // Monotonic v7
264
+ * const a = randomUUID({ version: "v7", monotonic: true });
265
+ * const b = randomUUID({ version: "v7", monotonic: true });
266
+ * // a < b lexicographically (guaranteed)
267
+ *
268
+ * @example
269
+ * // Throws TypeError
270
+ * randomUUID("v4" as any); // options must be object
271
+ * randomUUID({ version: 123 as any }); // version must be string
272
+ * randomUUID({ version: "v4", monotonic: true } as any); // monotonic only for v7
273
+ *
274
+ * @example
275
+ * // Throws RangeError
276
+ * randomUUID({ version: "v1" as any }); // unsupported version
277
+ */
278
+ declare function randomUUID(options?:OptionsRandomUUID):string;
279
+ /**
280
+ * --------------------------------------------------
173
281
  * * ***Utility: `noop`.***
174
282
  * --------------------------------------------------
175
- * **A no-operation function that always returns `undefined`.**
176
- * - *Useful as a default callback, placeholder, or stub function.*
177
- * @returns {undefined} Always returns `undefined`.
283
+ * **A no-operation function that performs no action.**
284
+ *
285
+ * @description
286
+ * Commonly used as a **placeholder**, **default callback**, or **stub function**.
287
+ *
288
+ * - **Behavior**:
289
+ * - Does not return any meaningful value (`void`).
290
+ * - Safely callable in any context without side effects.
291
+ *
292
+ * @remarks
293
+ * Although this function returns `void`, it implicitly results in `undefined`,
294
+ * but the return value should never be relied upon.
295
+ *
178
296
  * @example
179
- * // Direct call returns undefined
180
- * noop();
181
- * // undefined
297
+ * **1. Basic usage** — does nothing and returns undefined implicitly:
298
+ * ```
299
+ * import { noop } from "@rzl-zone/utils-js/generators";
182
300
  *
183
- * // Can be used with type-checking helpers
184
- * isFunction(noop); // ➔ true
185
- * isUndefined(noop()); // ➔ true
186
- * isFunction(noop()); // false
301
+ * noop(); // no effect (void)
302
+ * ```
303
+ * @example
304
+ * **2. Using with type-checking helpers:**
305
+ * ```ts
306
+ * import { noop } from "@rzl-zone/utils-js/generators";
307
+ * import { isFunction, isUndefined } from "@rzl-zone/utils-js/predicates";
308
+ *
309
+ * isFunction(noop); // ➔ true — `noop` is a function
310
+ * isUndefined(noop()); // ➔ true — calling `noop()` returns `undefined`
311
+ * isFunction(noop()); // ➔ false — the return value is `undefined`, not a function
312
+ * ```
313
+ * @example
314
+ * **3. As a default callback:**
315
+ * ```ts
316
+ * import { noop } from "@rzl-zone/utils-js/generators";
187
317
  *
188
- * // Often used as a default function
189
318
  * const callback = noop;
190
- * callback();
191
- * // ➔ undefined
319
+ * callback(); // ➔ no effect (void)
320
+ * ```
192
321
  */
193
- declare const noop:()=>void;export{getRandomItem,noop,randomInt,randomIntByLength,randomStr};
322
+ declare const noop:()=>void;export{getRandomItem,noop,randomInt,randomIntByLength,randomStr,randomUUID};
@@ -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 { getRandomItem, randomInt, randomIntByLength, randomStr } from '../chunk-ABA2ZSBQ.js';
10
+ export { getRandomItem, randomInt, randomIntByLength, randomStr, randomUUID } from '../chunk-SLP24LUV.js';
11
11
  import '../chunk-WVSPXFTY.js';
12
12
  export { noop } from '../chunk-YWHHVDT4.js';
13
13
  import '../chunk-2VO2CBTU.js';
package/dist/index.d.ts CHANGED
@@ -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
  * ====================================================
@@ -119,7 +119,7 @@ declare const isNumber:(value:unknown,options?:IsNumberOptions)=>value is number
119
119
  * - If `T` is `unknown`, the resulting type is `Record<PropertyKey, unknown> & T`.
120
120
  * - If `T` is an object:
121
121
  * - If it is a non-plain object (class instance, built-in object, etc.), the result is `never`.
122
- * - If it has no keys (`IsHasKeysObject<T>` checked by **{@link IsHasKeysObject}** is false), the result is `Record<PropertyKey, unknown> & T`.
122
+ * - If it has no keys (`IsHasKeysObject<T>` checked by **{@link IsHasKeysObject|`IsHasKeysObject`}** is false), the result is `Record<PropertyKey, unknown> & T`.
123
123
  * - Otherwise, the result is `T` itself.
124
124
  * - For any other types, the result is `never`.
125
125
  * @template T - The input type to be asserted as a plain object.
@@ -2,14 +2,14 @@
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 chunkBG3AS5BU_cjs = require('../chunk-BG3AS5BU.cjs');
12
+ var chunkSGCN4ED4_cjs = require('../chunk-SGCN4ED4.cjs');
13
13
  require('../chunk-VJVCXEH7.cjs');
14
14
  var chunkLIU4S3JA_cjs = require('../chunk-LIU4S3JA.cjs');
15
15
  var chunkNREACG6M_cjs = require('../chunk-NREACG6M.cjs');
@@ -25,7 +25,9 @@ function generateRoute(route, params) {
25
25
  - Invalid 'route' value.
26
26
  - Must be of type \`string\` and non-empty string, but received: "${chunkF3WBQKRI_cjs.getPreciseType(
27
27
  route
28
- )}": \`${chunkYC7AK3KX_cjs.safeStableStringify(route)}\`.`
28
+ )}": \`${chunkYC7AK3KX_cjs.safeStableStringify(route, {
29
+ keepUndefined: true
30
+ })}\`.`
29
31
  );
30
32
  }
31
33
  if (!/[\\[\]]/.test(route)) {
@@ -137,12 +139,12 @@ var createBeApiUrl = (pathname, options = {}) => {
137
139
  chunkF3WBQKRI_cjs.assertIsBoolean(withOrigin, {
138
140
  message: ({ currentType, validType }) => `Parameter \`withOrigin\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
139
141
  });
140
- pathname = chunkBG3AS5BU_cjs.normalizePathname(pathname);
141
- prefix = chunkBG3AS5BU_cjs.normalizePathname(prefix);
142
+ pathname = chunkSGCN4ED4_cjs.normalizePathname(pathname);
143
+ prefix = chunkSGCN4ED4_cjs.normalizePathname(prefix);
142
144
  const normalizedPrefix = prefix.endsWith("/") ? prefix : prefix + "/";
143
145
  if (pathname === prefix || pathname === prefix + "/" || pathname.startsWith(normalizedPrefix)) {
144
146
  pathname = pathname.slice(prefix.length);
145
- pathname = chunkBG3AS5BU_cjs.normalizePathname(pathname);
147
+ pathname = chunkSGCN4ED4_cjs.normalizePathname(pathname);
146
148
  }
147
149
  const baseApiUrl = getBeApiUrl({ suffix: prefix });
148
150
  const fullPath = withOrigin ? joinPath2(baseApiUrl, pathname) : joinPath2(new URL(baseApiUrl).pathname, pathname);
@@ -172,12 +174,12 @@ var getBeApiUrl = (options = {}) => {
172
174
  const urlObj = new URL(rawBaseUrl);
173
175
  const hasPort = !!urlObj.port;
174
176
  if (!hasPort && process.env.NEXT_PUBLIC_PORT_BE) {
175
- rawBaseUrl = urlObj.origin + chunkBG3AS5BU_cjs.formatEnvPort(process.env.NEXT_PUBLIC_PORT_BE, {
177
+ rawBaseUrl = urlObj.origin + chunkSGCN4ED4_cjs.formatEnvPort(process.env.NEXT_PUBLIC_PORT_BE, {
176
178
  prefixColon: true
177
179
  });
178
180
  }
179
181
  } else {
180
- rawBaseUrl = "http://localhost" + chunkBG3AS5BU_cjs.formatEnvPort(process.env.NEXT_PUBLIC_PORT_BE || "8000", {
182
+ rawBaseUrl = "http://localhost" + chunkSGCN4ED4_cjs.formatEnvPort(process.env.NEXT_PUBLIC_PORT_BE || "8000", {
181
183
  prefixColon: true
182
184
  });
183
185
  }
@@ -200,7 +202,7 @@ var getBaseUrl = () => {
200
202
  baseUrl = chunkLIU4S3JA_cjs.removeSpaces(baseUrl).replace(/\/+$/, "");
201
203
  const hasPort = /:\/\/[^/]+:\d+/.test(baseUrl);
202
204
  if (!hasPort && portEnv) {
203
- baseUrl += chunkBG3AS5BU_cjs.formatEnvPort(portEnv, { prefixColon: true });
205
+ baseUrl += chunkSGCN4ED4_cjs.formatEnvPort(portEnv, { prefixColon: true });
204
206
  } else if (!hasPort && !baseEnv) {
205
207
  baseUrl += ":3000";
206
208
  }
@@ -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
  * ====================================================
@@ -57,10 +57,10 @@ type HasDynamicSegments<T>=T extends`${string}[${string}]${string}`?true:false;t
57
57
  * @param {T} route - The route string containing dynamic segments.
58
58
  * @param {ExtractRouteParams<T>} [params] - An object containing key-value pairs that match the dynamic segments in the route.
59
59
  * @returns {string} The formatted URL with all dynamic segments replaced.
60
- * @throws {Error} If the route contains dynamic segments but no parameters object is provided.
61
- * @throws {Error} If a required parameter is missing from the `params` object.
62
- * @throws {Error} If a parameter value is an empty string.
63
- * @throws {Error} If any parameter contains invalid characters like `?`, `&`, `=`, `#`, `/`, spaces, `'`, `"`, `(`, `)`, `+`, `;`, `%`, `@`, or `:`, which can cause URL issues.
60
+ * @throws **{@link Error | `Error`}** if the route contains dynamic segments but no parameters object is provided.
61
+ * @throws **{@link Error | `Error`}** if a required parameter is missing from the `params` object.
62
+ * @throws **{@link Error | `Error`}** if a parameter value is an empty string.
63
+ * @throws **{@link Error | `Error`}** if any parameter contains invalid characters like `?`, `&`, `=`, `#`, `/`, spaces, `'`, `"`, `(`, `)`, `+`, `;`, `%`, `@`, or `:`, which can cause URL issues.
64
64
  * @example
65
65
  * // Basic usage
66
66
  * generateRoute("/user/[id]", { id: "123" });
@@ -115,9 +115,9 @@ withOrigin?:boolean;};
115
115
  * @param {OptionsCreateBeApiUrl["prefix"]} [options.prefix="/api"] - The prefix for the API path (default is `"/api"`).
116
116
  * @param {OptionsCreateBeApiUrl["withOrigin"]} [options.withOrigin=true] - Whether to include the full base URL or return only the API path.
117
117
  * @returns {string} The formatted API URL.
118
- * @throws {TypeError} If `withOrigin` is not a boolean.
119
- * @throws {TypeError} If `prefix` and `pathname` is not a string.
120
- * @throws {Error} If constructing the API URL fails due to an invalid base URL.
118
+ * @throws **{@link TypeError | `TypeError`}** if `withOrigin` is not a boolean.
119
+ * @throws **{@link TypeError | `TypeError`}** if `prefix` and `pathname` is not a string.
120
+ * @throws **{@link Error | `Error`}** if constructing the API URL fails due to an invalid base URL.
121
121
  * @example
122
122
  * createBeApiUrl("/users")
123
123
  * // ➔ "http://localhost:8000/api/users"
@@ -163,8 +163,8 @@ suffix?:string;};
163
163
  * @param {OptionsGetBeApiUrl|undefined} options - Configuration options.
164
164
  * @param {OptionsGetBeApiUrl["suffix"]} [options.suffix="/"] - The suffix to append to the base API URL.
165
165
  * @returns {string} The formatted backend API base URL.
166
- * @throws {TypeError} If `suffix` is not a `string`.
167
- * @throws {Error} If `NEXT_PUBLIC_BACKEND_API_URL` is invalid.
166
+ * @throws **{@link TypeError | `TypeError`}** if `suffix` is not a `string`.
167
+ * @throws **{@link Error | `Error`}** if `NEXT_PUBLIC_BACKEND_API_URL` is invalid.
168
168
  * @example
169
169
  * // With NEXT_PUBLIC_BACKEND_API_URL set at `*.env` file
170
170
  * NEXT_PUBLIC_BACKEND_API_URL = "https://api.example.com";
@@ -195,7 +195,7 @@ declare const getBeApiUrl:(options?:OptionsGetBeApiUrl)=>string;
195
195
  * - ***⚠️ Warning:***
196
196
  * - ***This function only support when using ***[`NextJS`](https://nextjs.org/)***.***
197
197
  * @returns {string} The resolved base URL of the application.
198
- * @throws {Error} If the constructed URL is invalid or malformed.
198
+ * @throws **{@link Error | `Error`}** if the constructed URL is invalid or malformed.
199
199
  * @example
200
200
  * // With environment variable set at `*.env` file
201
201
  * NEXT_PUBLIC_BASE_URL = "https://example.com";
@@ -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
- import { normalizePathname, formatEnvPort } from '../chunk-WNO3EPYT.js';
10
+ import { normalizePathname, formatEnvPort } from '../chunk-PW2VMJLT.js';
11
11
  import '../chunk-YS27V6LS.js';
12
12
  import { removeSpaces } from '../chunk-4ACKNPL5.js';
13
13
  import { isEmptyString } from '../chunk-JY4HLZ4W.js';
@@ -23,7 +23,9 @@ function generateRoute(route, params) {
23
23
  - Invalid 'route' value.
24
24
  - Must be of type \`string\` and non-empty string, but received: "${getPreciseType(
25
25
  route
26
- )}": \`${safeStableStringify(route)}\`.`
26
+ )}": \`${safeStableStringify(route, {
27
+ keepUndefined: true
28
+ })}\`.`
27
29
  );
28
30
  }
29
31
  if (!/[\\[\]]/.test(route)) {
@@ -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
  * ====================================================
@@ -14,12 +14,12 @@ import{NextRequest}from'next/server';
14
14
  * **Retrieves the real client IP address and constructs the full URL using headers like `x-forwarded-for`, `x-forwarded-proto`, and `x-forwarded-port`.**
15
15
  * - **ℹ️ Note:**
16
16
  * - Only supported in **Next.js** environments (specifically in `server-only` contexts).
17
- * - Should be used in **middleware** or **server actions** that have access to ***[`NextRequest - NextJS`](https://nextjs.org/docs/app/api-reference/functions/next-request)***.
17
+ * - Should be used in **middleware**, **route-handler** or **server actions** that have access to ***[`NextRequest - NextJS`](https://nextjs.org/docs/app/api-reference/functions/next-request)***.
18
18
  * @param {NextRequest} request - The incoming ***`NextJS`*** request object, must be instanceof `NextRequest` from `next/server`.
19
19
  * @param {boolean|undefined} [includeFullUrl=true] - Whether to return the full URL (`protocol`, `IP`, and `port` like `protocol://ip:port`) or just the IP address, defaultValue: `true`.
20
20
  * @returns {string} The extracted client IP address or the full constructed URL.
21
- * @throws {Error} If the function is used outside a Next.js server environment.
22
- * @throws {TypeError} If the arguments do not match the expected types.
21
+ * @throws **{@link Error | `Error`}** if the function is used outside a Next.js server environment.
22
+ * @throws **{@link TypeError | `TypeError`}** if the arguments do not match the expected types.
23
23
  * @example
24
24
  * // Basic usage in Next.js middleware
25
25
  * import { NextRequest } from "next/server";
@@ -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,15 +2,15 @@
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 chunkRMJC3B5P_cjs = require('../chunk-RMJC3B5P.cjs');
13
- require('../chunk-66WLOZOD.cjs');
12
+ var chunkA4H7474O_cjs = require('../chunk-A4H7474O.cjs');
13
+ require('../chunk-6NORJBI6.cjs');
14
14
  require('../chunk-7QQV66RX.cjs');
15
15
  require('../chunk-ATLFMKAF.cjs');
16
16
  require('../chunk-7WBMA2VE.cjs');
@@ -21,13 +21,13 @@ require('../chunk-F3WBQKRI.cjs');
21
21
 
22
22
  Object.defineProperty(exports, "findDuplicates", {
23
23
  enumerable: true,
24
- get: function () { return chunkRMJC3B5P_cjs.findDuplicates; }
24
+ get: function () { return chunkA4H7474O_cjs.findDuplicates; }
25
25
  });
26
26
  Object.defineProperty(exports, "omitKeys", {
27
27
  enumerable: true,
28
- get: function () { return chunkRMJC3B5P_cjs.omitKeys; }
28
+ get: function () { return chunkA4H7474O_cjs.omitKeys; }
29
29
  });
30
30
  Object.defineProperty(exports, "omitKeysDeep", {
31
31
  enumerable: true,
32
- get: function () { return chunkRMJC3B5P_cjs.omitKeysDeep; }
32
+ get: function () { return chunkA4H7474O_cjs.omitKeysDeep; }
33
33
  });
@@ -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
  * ====================================================
@@ -13,7 +13,7 @@ import{NumberRangeUnion}from'@rzl-zone/ts-types-plus';
13
13
  * ----------------------------------------------------------------------
14
14
  * **Finds duplicate values in an array by deep equality comparison.**
15
15
  * - **Behavior:**
16
- * - Uses ***{@link isEqual | `isEqual`}*** to compare elements
16
+ * - Uses ***`isEqual` utility function*** to compare elements
17
17
  * (handles objects, arrays, dates, NaN, etc.).
18
18
  * - Returns a new array containing only the *first occurrences* of duplicated values.
19
19
  * - Does **not mutate** the original array.
@@ -22,7 +22,7 @@ import{NumberRangeUnion}from'@rzl-zone/ts-types-plus';
22
22
  * @param {T[]} values - The array to check for duplicates.
23
23
  * @returns {T[]} An array of the duplicate values found in the input,
24
24
  * preserving order of their first duplicate appearance.
25
- * @throws {TypeError} If the provided `values` argument is not an array.
25
+ * @throws **{@link TypeError | `TypeError`}** if the provided `values` argument is not an array.
26
26
  * @example
27
27
  * findDuplicates([1, 2, 2, 3, 4, 4]);
28
28
  * // ➔ [2, 4]
@@ -47,15 +47,15 @@ declare const findDuplicates:<T>(values:T[])=>T[];
47
47
  * - It will return a new object without mutating the original.
48
48
  * - It also validates that ***`keysToOmit`*** does not contain duplicate keys.
49
49
  * - **ℹ️ Internally:**
50
- * - It uses ***{@link isEqual | `isEqual`}*** to check for duplicates in
50
+ * - It uses ***`isEqual`*** to check for duplicates in
51
51
  * the ***`keysToOmit`*** array.
52
52
  * @template I The type of the input object.
53
53
  * @template K The keys to omit from the object.
54
54
  * @param {I} object - The source object to omit keys from.
55
55
  * @param {K[]} keysToOmit - An array of keys to exclude from the returned object.
56
56
  * @returns {Omit<I, K>} A new object without the specified keys.
57
- * @throws {TypeError} If `keysToOmit` is not an array.
58
- * @throws {Error} If duplicate keys are found in `keysToOmit`.
57
+ * @throws **{@link TypeError | `TypeError`}** if `keysToOmit` is not an array.
58
+ * @throws **{@link Error | `Error`}** if duplicate keys are found in `keysToOmit`.
59
59
  * @example
60
60
  * omitKeys({ a: 1, b: 2, c: 3 }, ["b", "c"]);
61
61
  * //➔ { a: 1 }
@@ -90,9 +90,8 @@ declare const omitKeys:<I extends Record<string,unknown>,K extends keyof I>(obje
90
90
  * @returns {Partial<I>}
91
91
  * A new deeply cloned object with the specified keys omitted, with resulting
92
92
  * empty objects or arrays fully removed (even if it collapses to `{}`).
93
- * @throws {TypeError}
94
- * If `keysToOmit` is not an array will throw TypeError.
95
- * @throws {Error} If `keysToOmit` contains duplicate paths will throw Error.
93
+ * @throws **{@link TypeError | `TypeError`}** if `keysToOmit` is not an array.
94
+ * @throws **{@link Error | `Error`}** if `keysToOmit` contains duplicate paths.
96
95
  * @example
97
96
  * omitKeysDeep({ arr: [{ a: 1 }] }, ["arr.0.a"]);
98
97
  * // ➔ {} (array becomes empty and removed)
@@ -2,13 +2,13 @@
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 { findDuplicates, omitKeys, omitKeysDeep } from '../chunk-D53CE4BT.js';
11
- import '../chunk-XFTUHS4Y.js';
10
+ export { findDuplicates, omitKeys, omitKeysDeep } from '../chunk-P3ST4UZA.js';
11
+ import '../chunk-KVZ3HL2B.js';
12
12
  import '../chunk-SZJ7OI4S.js';
13
13
  import '../chunk-VCVND6CH.js';
14
14
  import '../chunk-6WMB5AJR.js';
@@ -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,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
  * ====================================================