@rzl-zone/utils-js 3.10.0 → 3.11.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.
Files changed (122) hide show
  1. package/README.md +131 -129
  2. package/dist/assertions/index.cjs +11 -11
  3. package/dist/assertions/index.d.ts +487 -215
  4. package/dist/assertions/index.js +5 -5
  5. package/dist/{chunk-SN5HAK3Y.js → chunk-22V4WP3H.js} +4 -4
  6. package/dist/{chunk-EJV5AF4L.js → chunk-2XSZ2ANI.js} +2 -2
  7. package/dist/{chunk-OSSFLQDD.js → chunk-3T6VSWYX.js} +2 -2
  8. package/dist/{chunk-3LE6NX57.js → chunk-5WIEDF2J.js} +4 -4
  9. package/dist/{chunk-WLEZ2KSG.cjs → chunk-6EDFZJZ5.cjs} +126 -126
  10. package/dist/{chunk-GHU356XQ.js → chunk-6LXWT2I5.js} +3 -3
  11. package/dist/{chunk-GKDSBOYE.js → chunk-6YGBRENU.js} +3 -3
  12. package/dist/{chunk-NAOVH4OH.cjs → chunk-7FGNVDEV.cjs} +7 -7
  13. package/dist/{chunk-X6ULJZ3X.js → chunk-AXDYWO67.js} +2 -2
  14. package/dist/{chunk-UV5BKAYW.cjs → chunk-B6PMNZ4M.cjs} +7 -7
  15. package/dist/chunk-BAV5T2E3.cjs +1 -1
  16. package/dist/{chunk-YHFRCVTN.js → chunk-BLF7SD66.js} +3 -3
  17. package/dist/{chunk-QZI5PVCI.cjs → chunk-BMZZXZJ2.cjs} +4 -4
  18. package/dist/{chunk-DXPM4NOU.js → chunk-BOYP3ARU.js} +4 -4
  19. package/dist/{chunk-UXT4XSUK.js → chunk-BPYW5YL7.js} +2 -2
  20. package/dist/{chunk-QGTFQ7RO.cjs → chunk-C2PV3VWC.cjs} +6 -6
  21. package/dist/{chunk-MZ3T6L7Z.js → chunk-CCJ2MSN7.js} +2 -2
  22. package/dist/{chunk-H44QVAZL.cjs → chunk-DAPAK2W3.cjs} +31 -31
  23. package/dist/{chunk-OYFUBKEG.cjs → chunk-DLS3G6WQ.cjs} +4 -4
  24. package/dist/{chunk-MS2KSKD7.js → chunk-DNMCR5JH.js} +9 -9
  25. package/dist/chunk-DVMHRLKP.cjs +1 -1
  26. package/dist/{chunk-IX6PF5ZP.cjs → chunk-EBYFYZW4.cjs} +4 -4
  27. package/dist/{chunk-5Y6JL47L.js → chunk-ENMRZ4BE.js} +3 -3
  28. package/dist/{chunk-7EIFPHV3.js → chunk-FJ4BQFVO.js} +8 -8
  29. package/dist/{chunk-TJ5OY6MC.cjs → chunk-GIKL4PUF.cjs} +10 -10
  30. package/dist/{chunk-M5QB2GM5.js → chunk-GOFINGT6.js} +2 -2
  31. package/dist/{chunk-J6VLFVIL.js → chunk-GXKQ3LHF.js} +3 -3
  32. package/dist/{chunk-5KDVIEVO.js → chunk-HNBRGN4R.js} +2 -2
  33. package/dist/{chunk-OCTHWEZK.cjs → chunk-HYN6FC5A.cjs} +34 -34
  34. package/dist/{chunk-MBFVTGYS.js → chunk-IZGVBYFN.js} +4 -4
  35. package/dist/{chunk-QXTJVDWE.js → chunk-JIE447J5.js} +3 -3
  36. package/dist/{chunk-UFYMRRJH.cjs → chunk-JXEIJM5M.cjs} +61 -61
  37. package/dist/{chunk-WB3FT62A.js → chunk-K47GZDBH.js} +3 -3
  38. package/dist/{chunk-KUVRZ2JW.cjs → chunk-K5536YHG.cjs} +50 -50
  39. package/dist/chunk-KHO2SBNA.cjs +1 -1
  40. package/dist/{chunk-NJ24M6ZH.cjs → chunk-KXJ7X325.cjs} +37 -37
  41. package/dist/chunk-L5RDAVVH.js +1 -1
  42. package/dist/{chunk-SRWL4YCP.js → chunk-LJHPTLWB.js} +7 -7
  43. package/dist/{chunk-6AMDHVS2.cjs → chunk-M7ELWZXM.cjs} +9 -9
  44. package/dist/chunk-MSUW5VHZ.js +1590 -0
  45. package/dist/{chunk-2XGQQZ6A.cjs → chunk-MUHRPRR7.cjs} +3 -3
  46. package/dist/{chunk-XYWC4EQ3.cjs → chunk-MV3TSQSH.cjs} +71 -71
  47. package/dist/{chunk-VCYXNIZ2.cjs → chunk-NLZLXWAU.cjs} +9 -9
  48. package/dist/{chunk-76ATVDCR.cjs → chunk-NVRZPF5M.cjs} +3 -3
  49. package/dist/chunk-ONZFBJVW.js +1 -1
  50. package/dist/{chunk-62FS7WMB.cjs → chunk-PGNL7JXO.cjs} +31 -31
  51. package/dist/{chunk-JI57K7D4.cjs → chunk-Q4GEQS7X.cjs} +161 -161
  52. package/dist/chunk-QNKGP5DY.js +1 -1
  53. package/dist/{chunk-ZTHJQJ5F.cjs → chunk-QYI2VJLS.cjs} +9 -9
  54. package/dist/{chunk-C7GC2PFX.js → chunk-RBWZII5I.js} +3 -3
  55. package/dist/{chunk-MMRHKYT6.cjs → chunk-RMP7VMPB.cjs} +12 -12
  56. package/dist/{chunk-TXOVQZPU.js → chunk-RZOGBYIS.js} +2 -2
  57. package/dist/{chunk-ALRISPTL.cjs → chunk-SU3UELUB.cjs} +3 -3
  58. package/dist/chunk-SYHPSOUU.cjs +1626 -0
  59. package/dist/{chunk-R2DR7SPJ.js → chunk-SZUNAEMR.js} +6 -6
  60. package/dist/{chunk-YVRUY4EW.cjs → chunk-TER22LO4.cjs} +8 -8
  61. package/dist/{chunk-WRGN6UBK.js → chunk-TJHGRQ4P.js} +2 -2
  62. package/dist/{chunk-I33PB44Q.cjs → chunk-U23I7JPB.cjs} +15 -15
  63. package/dist/{chunk-VBSLIIDB.js → chunk-U7HHN47R.js} +10 -10
  64. package/dist/chunk-UDA26MCU.cjs +1 -1
  65. package/dist/{chunk-44X74C26.js → chunk-UIAWUZ4H.js} +4 -4
  66. package/dist/{chunk-5O66AUEC.js → chunk-ULQPCIA2.js} +2 -2
  67. package/dist/chunk-VJDDGRIK.cjs +1 -1
  68. package/dist/{chunk-6WVOUVWD.js → chunk-WETQI6HM.js} +9 -9
  69. package/dist/{chunk-FWWPEL7J.cjs → chunk-WLOQQFDS.cjs} +3 -3
  70. package/dist/chunk-WVSPXFTY.js +1 -1
  71. package/dist/{chunk-WKM6UVMG.cjs → chunk-WXFTVXBF.cjs} +4 -4
  72. package/dist/{chunk-YQHJB7KR.cjs → chunk-XPVTIGU2.cjs} +26 -26
  73. package/dist/{chunk-PWKOFPAH.cjs → chunk-XX6RUGTM.cjs} +3 -3
  74. package/dist/chunk-YWHHVDT4.js +1 -1
  75. package/dist/{chunk-7NXFGJJE.cjs → chunk-ZPDMWDGZ.cjs} +14 -14
  76. package/dist/{chunk-JYOCB6OV.js → chunk-ZVWZEGQP.js} +2 -2
  77. package/dist/conversions/index.cjs +34 -34
  78. package/dist/conversions/index.d.ts +489 -333
  79. package/dist/conversions/index.js +15 -15
  80. package/dist/events/index.cjs +8 -8
  81. package/dist/events/index.d.ts +35 -29
  82. package/dist/events/index.js +4 -4
  83. package/dist/formatters/index.cjs +19 -19
  84. package/dist/formatters/index.d.ts +917 -873
  85. package/dist/formatters/index.js +9 -9
  86. package/dist/generators/index.cjs +9 -9
  87. package/dist/generators/index.d.ts +104 -86
  88. package/dist/generators/index.js +4 -4
  89. package/dist/index.d.ts +1 -1
  90. package/dist/isPlainObject-0p3VveWr.d.ts +534 -0
  91. package/dist/next/index.cjs +37 -37
  92. package/dist/next/index.d.ts +36 -21
  93. package/dist/next/index.js +9 -9
  94. package/dist/next/server/index.cjs +4 -4
  95. package/dist/next/server/index.d.ts +6 -3
  96. package/dist/next/server/index.js +2 -2
  97. package/dist/operations/index.cjs +11 -11
  98. package/dist/operations/index.d.ts +14 -5
  99. package/dist/operations/index.js +8 -8
  100. package/dist/parsers/index.cjs +6 -6
  101. package/dist/parsers/index.d.ts +68 -65
  102. package/dist/parsers/index.js +5 -5
  103. package/dist/predicates/index.cjs +77 -77
  104. package/dist/predicates/index.d.ts +442 -258
  105. package/dist/predicates/index.js +14 -14
  106. package/dist/promises/index.cjs +6 -6
  107. package/dist/promises/index.d.ts +28 -16
  108. package/dist/promises/index.js +4 -4
  109. package/dist/rzl-utils.global.js +2 -2
  110. package/dist/strings/index.cjs +23 -23
  111. package/dist/strings/index.d.ts +82 -54
  112. package/dist/strings/index.js +7 -7
  113. package/dist/tailwind/index.cjs +13 -13
  114. package/dist/tailwind/index.d.ts +186 -169
  115. package/dist/tailwind/index.js +5 -5
  116. package/dist/urls/index.cjs +23 -23
  117. package/dist/urls/index.d.ts +252 -229
  118. package/dist/urls/index.js +16 -16
  119. package/package.json +6 -4
  120. package/dist/chunk-7C7TQC5J.cjs +0 -620
  121. package/dist/chunk-J4TT33ZX.js +0 -584
  122. package/dist/isPlainObject-BTPjv6zB.d.ts +0 -178
@@ -2,7 +2,7 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.10.0.
5
+ * Version: 3.11.1.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
@@ -32,7 +32,7 @@
32
32
  * // ❌ invalid: key without value pairs.
33
33
  * const empty2: QueryParamPairs = [["key"]];
34
34
  */
35
- type QueryParamPairs=[[string,string|number],...[string,string|number][]];
35
+ type QueryParamPairs = [[string, string | number], ...[string, string | number][]];
36
36
  /** ---------------------------------
37
37
  * * ***Utility: `constructURL`.***
38
38
  * ---------------------------------
@@ -82,7 +82,8 @@ type QueryParamPairs=[[string,string|number],...[string,string|number][]];
82
82
  * // ➔ URL { href: "https://example.com/?foo=1&baz=3", ... }
83
83
  * ```
84
84
  */
85
- declare const constructURL:(baseUrl:string|URL,queryParams?:URLSearchParamsIterator<[string,string|number]>|QueryParamPairs,removeParams?:string[])=>URL;
85
+ declare const constructURL: (baseUrl: string | URL, queryParams?: URLSearchParamsIterator<[string, string | number]> | QueryParamPairs, removeParams?: string[]) => URL;
86
+
86
87
  /** ---------------------------------
87
88
  * * ***Utility: `extractURLs`.***
88
89
  * ---------------------------------
@@ -108,7 +109,8 @@ declare const constructURL:(baseUrl:string|URL,queryParams?:URLSearchParamsItera
108
109
  * extractURLs("ftp://example.com http://example.com");
109
110
  * // ➔ ["http://example.com"]
110
111
  */
111
- declare const extractURLs:(url:string|null|undefined)=>string[]|null;
112
+ declare const extractURLs: (url: string | null | undefined) => string[] | null;
113
+
112
114
  /** --------------------------------------------------------
113
115
  * * ***Utility: `getFirstPrefixPathname`.***
114
116
  * --------------------------------------------------------
@@ -204,19 +206,22 @@ declare const extractURLs:(url:string|null|undefined)=>string[]|null;
204
206
  * ***The first valid normalized pathname, or the normalized default.***
205
207
  * @throws **{@link TypeError | `TypeError`}** ***if `result` is not a valid type, or `defaultValue` is not a string or empty-string.***
206
208
  */
207
- declare const getFirstPrefixPathname:(result:string|string[]|null|undefined,defaultValue?:string)=>string;type GetPrefixPathnameOptions={
208
- /** The number of levels to include in the prefix (default is `1`).
209
- *
210
- * - For example, with `levels = 2`, the function will return the first two parts of the URL.
211
- *
212
- * @default 1
213
- */
214
- levels?:number;
215
- /** Whether to remove duplicates from the result if multiple URLs are passed (default is `true`).
216
- *
217
- * @default true
218
- */
219
- removeDuplicates?:boolean;};
209
+ declare const getFirstPrefixPathname: (result: string | string[] | null | undefined, defaultValue?: string) => string;
210
+
211
+ type GetPrefixPathnameOptions = {
212
+ /** The number of levels to include in the prefix (default is `1`).
213
+ *
214
+ * - For example, with `levels = 2`, the function will return the first two parts of the URL.
215
+ *
216
+ * @default 1
217
+ */
218
+ levels?: number;
219
+ /** Whether to remove duplicates from the result if multiple URLs are passed (default is `true`).
220
+ *
221
+ * @default true
222
+ */
223
+ removeDuplicates?: boolean;
224
+ };
220
225
  /** --------------------------------------------------------
221
226
  * * ***Utility: `getPrefixPathname`.***
222
227
  * --------------------------------------------------------
@@ -345,138 +350,147 @@ removeDuplicates?:boolean;};
345
350
  * console.log(result); // ➔ null
346
351
  * ```
347
352
  */
348
- declare const getPrefixPathname:(url:string|string[],base?:string|string[]|null,options?:GetPrefixPathnameOptions)=>string|string[]|null;
353
+ declare const getPrefixPathname: (url: string | string[], base?: string | string[] | null, options?: GetPrefixPathnameOptions) => string | string[] | null;
354
+
349
355
  /** Options when `keepNullable` is false (default).
350
356
  *
351
357
  * Returns `defaultPath` if `pathname` is empty or invalid.
352
358
  */
353
- type UnKeepNullableOptions={
354
- /** * ***Fallback value returned if `pathname` is empty-string or invalid.***
355
- *
356
- * Must be a **`non-empty string`**, defaultValue: `"/"`.
357
- *
358
- * @defaultValue `"/"`.
359
- */
360
- defaultPath?:string;
361
- /** * ***Whether to preserve `null` or `undefined`, defaultValue: `false`.***
362
- *
363
- * @defaultValue `false`.
364
- */
365
- keepNullable?:false;};
359
+ type UnKeepNullableOptions = {
360
+ /** * ***Fallback value returned if `pathname` is empty-string or invalid.***
361
+ *
362
+ * Must be a **`non-empty string`**, defaultValue: `"/"`.
363
+ *
364
+ * @defaultValue `"/"`.
365
+ */
366
+ defaultPath?: string;
367
+ /** * ***Whether to preserve `null` or `undefined`, defaultValue: `false`.***
368
+ *
369
+ * @defaultValue `false`.
370
+ */
371
+ keepNullable?: false;
372
+ };
366
373
  /** Options when `keepNullable` is true.
367
374
  *
368
375
  * Preserves `null` or `undefined` instead of returning `defaultPath`.
369
376
  */
370
- type KeepNullableOptions={
371
- /** * ***Fallback path is ignored when `keepNullable` is true **(except if
372
- * `pathname` is empty-string or invalid, even this `true`)**,
373
- * defaultValue: `"/"`.***
374
- *
375
- * @defaultValue `"/"`.
376
- */
377
- defaultPath?:string;
378
- /** * ***Preserve `null` or `undefined` as-is if `true` (defaultValue: `false`).***
379
- *
380
- * - ***⚠️ Notes:***
381
- * - Keep returning `defaultPath` if `pathname` is empty-string, even this `true`.
382
- *
383
- * **Must be `true` in this type.**
384
- */
385
- keepNullable?:true;};type MainNormalizePathnameOptions={
386
- /** --------------------------------------------------------
387
- * * ***Preserve trailing slash at the end of the normalized pathname, defaultValue: `false`.***
388
- * --------------------------------------------------------
389
- *
390
- * @defaultValue `false`
391
- */
392
- keepTrailingSlash?:boolean;
393
- /** --------------------------------------------------------
394
- * * ***Allow special localhost domain at the beginning of the pathname.***
395
- * --------------------------------------------------------
396
- * @description
397
- * If `true`, the first segment of the pathname that is `/localhost` or `localhost`
398
- * (with or without a port, e.g., `localhost:3000`) will be treated as a special domain
399
- * and **removed** from the normalized pathname.
400
- *
401
- * - **Examples (`localhostDomain: true`)**:
402
- * - `"/localhost/path"` ➔ `"/path"`
403
- * - `"localhost:3000/path"` `"/path"`
404
- * - `"localhost"` ➔ `"/"` (entire path removed)
405
- *
406
- * - Only the **first path segment** is affected. Any subsequent occurrences of `"localhost"`
407
- * will remain intact.
408
- *
409
- * @defaultValue `false`
410
- */
411
- localhostDomain?:boolean;
412
- /**
413
- * --------------------------------------------------------
414
- * * ***Custom list of file extensions that prevent the first path segment from being treated as a domain.***
415
- * --------------------------------------------------------
416
- *
417
- * **Description:**
418
- * - The first segment of a pathname is often interpreted as a domain (e.g., `example.com`).
419
- * - If this first segment ends with any of the extensions listed here, it will **not** be considered a domain,
420
- * and will instead be preserved as part of the relative path.
421
- * - This is useful for cases where filenames appear at the start of a path and you want them treated as relative paths,
422
- * such as `"image.png?version=2"` or `"archive.tar.gz#download"`.
423
- * - Only the **first path segment** is affected; all other segments are processed normally.
424
- * - **Ignored** if:
425
- * 1. The pathname starts with a full URL protocol (`http://` or `https://`), e.g., `"https://example.com/file.png"`.
426
- * 2. The first path segment is already a valid domain, e.g., `"example.com/image.png"`.
427
- *
428
- * **Type & Validation:**
429
- * - Must be a `Set<string>` or `string[]`.
430
- * - Each string **must include the leading dot**, e.g., `.png`, `.tar.gz`.
431
- * - Multi-part extensions (like `.tar.gz`, `.tar.bz`) are supported.
432
- * - Throws a **TypeError** if:
433
- * 1. The type is not a `Set<string>` or `string[]`.
434
- * 2. Any string in the array/set is empty.
435
- * 3. Any string does not start with a dot (`.`).
436
- *
437
- * **Usage Notes:**
438
- * - Only applied when the first segment is otherwise domain-like **and** pathname is relative or domain-like without protocol.
439
- * - Query strings (`?x=1`) and hash fragments (`#section`) are preserved.
440
- *
441
- * **Examples (relative paths, option active):**
442
- * ```ts
443
- * normalizePathname("image.png?version=2", {
444
- * ignoreDomainExtensions: [".png", ".jpg"]
445
- * });
446
- * // ➔ "/image.png?version=2"
447
- *
448
- * normalizePathname("archive.tar.gz#download", {
449
- * ignoreDomainExtensions: new Set([".tar.gz"])
450
- * });
451
- * // "/archive.tar.gz#download"
452
- *
453
- * normalizePathname("script.js?module=true#top", {
454
- * ignoreDomainExtensions: [".js"]
455
- * });
456
- * // ➔ "/script.js?module=true#top"
457
- * ```
458
- *
459
- * **Examples (full URL or explicit domain - option ignored):**
460
- * ```ts
461
- * normalizePathname("https://example.com/image.png?version=2", {
462
- * ignoreDomainExtensions: [".png"]
463
- * });
464
- * // ➔ "/image.png?version=2" // URL is parsed normally; ignoreDomainExtensions has no effect
465
- *
466
- * normalizePathname("example.com/script.js?module=true#top", {
467
- * ignoreDomainExtensions: [".js"]
468
- * });
469
- * // ➔ "/script.js?module=true#top" // domain recognized; option ignored
470
- * ```
471
- *
472
- * **Notes:**
473
- * - Only the **first path segment** is checked.
474
- * - Prevents false-positive domain stripping for filenames that look like domains.
475
- * - Throws **TypeError** if invalid type or invalid string is provided.
476
- *
477
- * @defaultValue `undefined` (feature inactive if not provided)
478
- */
479
- ignoreDomainExtensions?:Set<string>|string[];};type NormalizePathnameOptionsKeepNullableTrue=MainNormalizePathnameOptions & KeepNullableOptions;type NormalizePathnameOptionsKeepNullableFalse=MainNormalizePathnameOptions & UnKeepNullableOptions;type ResUnKeepNullable<T>=T extends undefined?string:T extends null?string:T extends null|undefined?string:string;type ResKeepNullable<T>=T extends string?string:T extends undefined?undefined:T extends null?null:T extends null|undefined?null|undefined:string|null|undefined;
377
+ type KeepNullableOptions = {
378
+ /** * ***Fallback path is ignored when `keepNullable` is true **(except if
379
+ * `pathname` is empty-string or invalid, even this `true`)**,
380
+ * defaultValue: `"/"`.***
381
+ *
382
+ * @defaultValue `"/"`.
383
+ */
384
+ defaultPath?: string;
385
+ /** * ***Preserve `null` or `undefined` as-is if `true` (defaultValue: `false`).***
386
+ *
387
+ * - ***⚠️ Notes:***
388
+ * - Keep returning `defaultPath` if `pathname` is empty-string, even this `true`.
389
+ *
390
+ * **Must be `true` in this type.**
391
+ */
392
+ keepNullable?: true;
393
+ };
394
+ type MainNormalizePathnameOptions = {
395
+ /** --------------------------------------------------------
396
+ * * ***Preserve trailing slash at the end of the normalized pathname, defaultValue: `false`.***
397
+ * --------------------------------------------------------
398
+ *
399
+ * @defaultValue `false`
400
+ */
401
+ keepTrailingSlash?: boolean;
402
+ /** --------------------------------------------------------
403
+ * * ***Allow special localhost domain at the beginning of the pathname.***
404
+ * --------------------------------------------------------
405
+ * @description
406
+ * If `true`, the first segment of the pathname that is `/localhost` or `localhost`
407
+ * (with or without a port, e.g., `localhost:3000`) will be treated as a special domain
408
+ * and **removed** from the normalized pathname.
409
+ *
410
+ * - **Examples (`localhostDomain: true`)**:
411
+ * - `"/localhost/path"` ➔ `"/path"`
412
+ * - `"localhost:3000/path"` ➔ `"/path"`
413
+ * - `"localhost"` `"/"` (entire path removed)
414
+ *
415
+ * - Only the **first path segment** is affected. Any subsequent occurrences of `"localhost"`
416
+ * will remain intact.
417
+ *
418
+ * @defaultValue `false`
419
+ */
420
+ localhostDomain?: boolean;
421
+ /**
422
+ * --------------------------------------------------------
423
+ * * ***Custom list of file extensions that prevent the first path segment from being treated as a domain.***
424
+ * --------------------------------------------------------
425
+ *
426
+ * **Description:**
427
+ * - The first segment of a pathname is often interpreted as a domain (e.g., `example.com`).
428
+ * - If this first segment ends with any of the extensions listed here, it will **not** be considered a domain,
429
+ * and will instead be preserved as part of the relative path.
430
+ * - This is useful for cases where filenames appear at the start of a path and you want them treated as relative paths,
431
+ * such as `"image.png?version=2"` or `"archive.tar.gz#download"`.
432
+ * - Only the **first path segment** is affected; all other segments are processed normally.
433
+ * - **Ignored** if:
434
+ * 1. The pathname starts with a full URL protocol (`http://` or `https://`), e.g., `"https://example.com/file.png"`.
435
+ * 2. The first path segment is already a valid domain, e.g., `"example.com/image.png"`.
436
+ *
437
+ * **Type & Validation:**
438
+ * - Must be a `Set<string>` or `string[]`.
439
+ * - Each string **must include the leading dot**, e.g., `.png`, `.tar.gz`.
440
+ * - Multi-part extensions (like `.tar.gz`, `.tar.bz`) are supported.
441
+ * - Throws a **TypeError** if:
442
+ * 1. The type is not a `Set<string>` or `string[]`.
443
+ * 2. Any string in the array/set is empty.
444
+ * 3. Any string does not start with a dot (`.`).
445
+ *
446
+ * **Usage Notes:**
447
+ * - Only applied when the first segment is otherwise domain-like **and** pathname is relative or domain-like without protocol.
448
+ * - Query strings (`?x=1`) and hash fragments (`#section`) are preserved.
449
+ *
450
+ * **Examples (relative paths, option active):**
451
+ * ```ts
452
+ * normalizePathname("image.png?version=2", {
453
+ * ignoreDomainExtensions: [".png", ".jpg"]
454
+ * });
455
+ * // ➔ "/image.png?version=2"
456
+ *
457
+ * normalizePathname("archive.tar.gz#download", {
458
+ * ignoreDomainExtensions: new Set([".tar.gz"])
459
+ * });
460
+ * // ➔ "/archive.tar.gz#download"
461
+ *
462
+ * normalizePathname("script.js?module=true#top", {
463
+ * ignoreDomainExtensions: [".js"]
464
+ * });
465
+ * // ➔ "/script.js?module=true#top"
466
+ * ```
467
+ *
468
+ * **Examples (full URL or explicit domain - option ignored):**
469
+ * ```ts
470
+ * normalizePathname("https://example.com/image.png?version=2", {
471
+ * ignoreDomainExtensions: [".png"]
472
+ * });
473
+ * // ➔ "/image.png?version=2" // URL is parsed normally; ignoreDomainExtensions has no effect
474
+ *
475
+ * normalizePathname("example.com/script.js?module=true#top", {
476
+ * ignoreDomainExtensions: [".js"]
477
+ * });
478
+ * // ➔ "/script.js?module=true#top" // domain recognized; option ignored
479
+ * ```
480
+ *
481
+ * **Notes:**
482
+ * - Only the **first path segment** is checked.
483
+ * - Prevents false-positive domain stripping for filenames that look like domains.
484
+ * - Throws **TypeError** if invalid type or invalid string is provided.
485
+ *
486
+ * @defaultValue `undefined` (feature inactive if not provided)
487
+ */
488
+ ignoreDomainExtensions?: Set<string> | string[];
489
+ };
490
+ type NormalizePathnameOptionsKeepNullableTrue = MainNormalizePathnameOptions & KeepNullableOptions;
491
+ type NormalizePathnameOptionsKeepNullableFalse = MainNormalizePathnameOptions & UnKeepNullableOptions;
492
+ type ResUnKeepNullable<T> = T extends undefined ? string : T extends null ? string : T extends null | undefined ? string : string;
493
+ type ResKeepNullable<T> = T extends string ? string : T extends undefined ? undefined : T extends null ? null : T extends null | undefined ? null | undefined : string | null | undefined;
480
494
  /** --------------------------------------------------------
481
495
  * * ***Utility: `normalizePathname`.***
482
496
  * --------------------------------------------------------
@@ -599,12 +613,16 @@ ignoreDomainExtensions?:Set<string>|string[];};type NormalizePathnameOptionsKeep
599
613
  * normalizePathname("example.tar.bz/file", { ignoreDomainExtensions: [".tar.bz"] });
600
614
  * // ➔ "/example.tar.bz/file"
601
615
  */
602
- declare function normalizePathname<T>(pathname:T,options?:NormalizePathnameOptionsKeepNullableFalse):ResUnKeepNullable<T>;declare function normalizePathname<T>(pathname:T,options?:NormalizePathnameOptionsKeepNullableTrue):ResKeepNullable<T>;type FormatEnvPortOptions={
603
- /** Add prefix with a colon, defaultValue: `false`.
604
- *
605
- * @default false
606
- */
607
- prefixColon?:boolean;};
616
+ declare function normalizePathname<T>(pathname: T, options?: NormalizePathnameOptionsKeepNullableFalse): ResUnKeepNullable<T>;
617
+ declare function normalizePathname<T>(pathname: T, options?: NormalizePathnameOptionsKeepNullableTrue): ResKeepNullable<T>;
618
+
619
+ type FormatEnvPortOptions = {
620
+ /** Add prefix with a colon, defaultValue: `false`.
621
+ *
622
+ * @default false
623
+ */
624
+ prefixColon?: boolean;
625
+ };
608
626
  /** -----------------------------------------------
609
627
  * * ***Utility: `formatEnvPort`.***
610
628
  * -----------------------------------------------
@@ -624,7 +642,8 @@ prefixColon?:boolean;};
624
642
  * formatEnvPort("port:8080", { prefixColon: true });
625
643
  * // ➔ ":8080"
626
644
  */
627
- declare const formatEnvPort:(envVar:string|null|undefined,options?:FormatEnvPortOptions)=>string;
645
+ declare const formatEnvPort: (envVar: string | null | undefined, options?: FormatEnvPortOptions) => string;
646
+
628
647
  /** ---------------------------------------------------------
629
648
  * * ***Constants for `Punycode-UtilsJS` algorithm.***
630
649
  * ---------------------------------------------------------
@@ -632,86 +651,88 @@ declare const formatEnvPort:(envVar:string|null|undefined,options?:FormatEnvPort
632
651
  *
633
652
  * Unicode domain names to ASCII (`Punycode-UtilsJS`) and vice versa.
634
653
  */
635
- type PunycodeUtilsJS={
636
- /** ---------------------------------------------------------
637
- * * ***Version of the `Punycode-UtilsJS` implementation.***
638
- * ---------------------------------------------------------
639
- *
640
- * @example
641
- * console.log(punycodeUtilsJS.version); // "1.0.0"
642
- */
643
- version:string;
644
- /** ---------------------------------------------------------
645
- * * ***UCS-2 utility functions.***
646
- * ---------------------------------------------------------
647
- */
648
- ucs2:{
649
- /** ---------------------------------------------------------
650
- * * ***Decodes a UCS-2 encoded string to an array of Unicode code points.***
651
- * ---------------------------------------------------------
652
- *
653
- * @param input - The UCS-2 string to decode.
654
- * @returns Array of Unicode code points.
655
- * @example
656
- * punycodeUtilsJS.ucs2.decode("𐍈");
657
- * // ➔ [66376]
658
- */
659
- decode:(input:string)=>number[];
660
- /** ---------------------------------------------------------
661
- * * ***Encodes an array of Unicode code points to a UCS-2 string.***
662
- * ---------------------------------------------------------
663
- *
664
- * @param points - Array of Unicode code points.
665
- * @returns Encoded string.
666
- * @example
667
- * punycodeUtilsJS.ucs2.encode([66376]);
668
- * // ➔ "𐍈"
669
- */
670
- encode:(points:number[])=>string;};
671
- /** ---------------------------------------------------------
672
- * * ***Decodes a `Punycode-UtilsJS` string to a Unicode string.***
673
- * ---------------------------------------------------------
674
- *
675
- * @param input - The `Punycode-UtilsJS` string to decode.
676
- * @returns Decoded Unicode string.
677
- * @example
678
- * punycodeUtilsJS.decode("xn--fsq");
679
- * // ➔ "ü"
680
- */
681
- decode:(input:string)=>string;
682
- /** ---------------------------------------------------------
683
- * * ***Encodes a Unicode string to `Punycode-UtilsJS`.***
684
- * ---------------------------------------------------------
685
- *
686
- * @param input - Unicode string to encode.
687
- * @returns `Punycode-UtilsJS` string.
688
- * @example
689
- * punycodeUtilsJS.encode("ü");
690
- * // ➔ "xn--fsq"
691
- */
692
- encode:(input:string)=>string;
693
- /** ---------------------------------------------------------
694
- * * ***Converts a Unicode domain or label to ASCII (`Punycode-UtilsJS`).***
695
- * ---------------------------------------------------------
696
- *
697
- * @param input - Domain or label string.
698
- * @returns ASCII string suitable for DNS.
699
- * @example
700
- * punycodeUtilsJS.toASCII("пример.рф");
701
- * // ➔ "xn--e1afmkfd.xn--p1ai"
702
- */
703
- toASCII:(input:string)=>string;
704
- /** ---------------------------------------------------------
705
- * * ***Converts an ASCII (`Punycode-UtilsJS`) domain or label to Unicode.***
706
- * ---------------------------------------------------------
707
- *
708
- * @param input - ASCII string (with xn-- prefix if needed).
709
- * @returns Unicode string.
710
- * @example
711
- * punycodeUtilsJS.toUnicode("xn--e1afmkfd.xn--p1ai");
712
- * // ➔ "пример.рф"
713
- */
714
- toUnicode:(input:string)=>string;};
654
+ type PunycodeUtilsJS = {
655
+ /** ---------------------------------------------------------
656
+ * * ***Version of the `Punycode-UtilsJS` implementation.***
657
+ * ---------------------------------------------------------
658
+ *
659
+ * @example
660
+ * console.log(punycodeUtilsJS.version); // "1.0.0"
661
+ */
662
+ version: string;
663
+ /** ---------------------------------------------------------
664
+ * * ***UCS-2 utility functions.***
665
+ * ---------------------------------------------------------
666
+ */
667
+ ucs2: {
668
+ /** ---------------------------------------------------------
669
+ * * ***Decodes a UCS-2 encoded string to an array of Unicode code points.***
670
+ * ---------------------------------------------------------
671
+ *
672
+ * @param input - The UCS-2 string to decode.
673
+ * @returns Array of Unicode code points.
674
+ * @example
675
+ * punycodeUtilsJS.ucs2.decode("𐍈");
676
+ * // ➔ [66376]
677
+ */
678
+ decode: (input: string) => number[];
679
+ /** ---------------------------------------------------------
680
+ * * ***Encodes an array of Unicode code points to a UCS-2 string.***
681
+ * ---------------------------------------------------------
682
+ *
683
+ * @param points - Array of Unicode code points.
684
+ * @returns Encoded string.
685
+ * @example
686
+ * punycodeUtilsJS.ucs2.encode([66376]);
687
+ * // ➔ "𐍈"
688
+ */
689
+ encode: (points: number[]) => string;
690
+ };
691
+ /** ---------------------------------------------------------
692
+ * * ***Decodes a `Punycode-UtilsJS` string to a Unicode string.***
693
+ * ---------------------------------------------------------
694
+ *
695
+ * @param input - The `Punycode-UtilsJS` string to decode.
696
+ * @returns Decoded Unicode string.
697
+ * @example
698
+ * punycodeUtilsJS.decode("xn--fsq");
699
+ * // ➔ "ü"
700
+ */
701
+ decode: (input: string) => string;
702
+ /** ---------------------------------------------------------
703
+ * * ***Encodes a Unicode string to `Punycode-UtilsJS`.***
704
+ * ---------------------------------------------------------
705
+ *
706
+ * @param input - Unicode string to encode.
707
+ * @returns `Punycode-UtilsJS` string.
708
+ * @example
709
+ * punycodeUtilsJS.encode("ü");
710
+ * // ➔ "xn--fsq"
711
+ */
712
+ encode: (input: string) => string;
713
+ /** ---------------------------------------------------------
714
+ * * ***Converts a Unicode domain or label to ASCII (`Punycode-UtilsJS`).***
715
+ * ---------------------------------------------------------
716
+ *
717
+ * @param input - Domain or label string.
718
+ * @returns ASCII string suitable for DNS.
719
+ * @example
720
+ * punycodeUtilsJS.toASCII("пример.рф");
721
+ * // ➔ "xn--e1afmkfd.xn--p1ai"
722
+ */
723
+ toASCII: (input: string) => string;
724
+ /** ---------------------------------------------------------
725
+ * * ***Converts an ASCII (`Punycode-UtilsJS`) domain or label to Unicode.***
726
+ * ---------------------------------------------------------
727
+ *
728
+ * @param input - ASCII string (with xn-- prefix if needed).
729
+ * @returns Unicode string.
730
+ * @example
731
+ * punycodeUtilsJS.toUnicode("xn--e1afmkfd.xn--p1ai");
732
+ * // ➔ "пример.рф"
733
+ */
734
+ toUnicode: (input: string) => string;
735
+ };
715
736
  /** ---------------------------------------------------------
716
737
  * * ***`Punycode-UtilsJS` object exposing all API functions and version.***
717
738
  * ---------------------------------------------------------
@@ -720,4 +741,6 @@ toUnicode:(input:string)=>string;};
720
741
  *
721
742
  * - Useful for IDN (Internationalized Domain Names) support.
722
743
  */
723
- declare const punycodeUtilsJS:PunycodeUtilsJS;export{type QueryParamPairs,constructURL,extractURLs,formatEnvPort,getFirstPrefixPathname,getPrefixPathname,normalizePathname,punycodeUtilsJS};
744
+ declare const punycodeUtilsJS: PunycodeUtilsJS;
745
+
746
+ export { type QueryParamPairs, constructURL, extractURLs, formatEnvPort, getFirstPrefixPathname, getPrefixPathname, normalizePathname, punycodeUtilsJS };
@@ -2,26 +2,26 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.10.0.
5
+ * Version: 3.11.1.
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-6WVOUVWD.js';
10
+ export { constructURL, extractURLs, getFirstPrefixPathname, getPrefixPathname } from '../chunk-WETQI6HM.js';
11
11
  import '../chunk-ONZFBJVW.js';
12
- import '../chunk-UXT4XSUK.js';
13
- import '../chunk-SN5HAK3Y.js';
14
- import '../chunk-44X74C26.js';
15
- import '../chunk-MZ3T6L7Z.js';
12
+ import '../chunk-BPYW5YL7.js';
13
+ import '../chunk-22V4WP3H.js';
14
+ import '../chunk-UIAWUZ4H.js';
15
+ import '../chunk-CCJ2MSN7.js';
16
16
  import '../chunk-WVSPXFTY.js';
17
- export { formatEnvPort, normalizePathname } from '../chunk-R2DR7SPJ.js';
18
- import '../chunk-3LE6NX57.js';
19
- export { punycodeUtilsJS } from '../chunk-GKDSBOYE.js';
20
- import '../chunk-5KDVIEVO.js';
21
- import '../chunk-5O66AUEC.js';
22
- import '../chunk-OSSFLQDD.js';
23
- import '../chunk-M5QB2GM5.js';
24
- import '../chunk-TXOVQZPU.js';
25
- import '../chunk-X6ULJZ3X.js';
17
+ export { formatEnvPort, normalizePathname } from '../chunk-SZUNAEMR.js';
18
+ import '../chunk-5WIEDF2J.js';
19
+ export { punycodeUtilsJS } from '../chunk-6YGBRENU.js';
20
+ import '../chunk-HNBRGN4R.js';
21
+ import '../chunk-ULQPCIA2.js';
22
+ import '../chunk-3T6VSWYX.js';
23
+ import '../chunk-GOFINGT6.js';
24
+ import '../chunk-RZOGBYIS.js';
25
+ import '../chunk-AXDYWO67.js';
26
26
  import '../chunk-QNKGP5DY.js';
27
- import '../chunk-J4TT33ZX.js';
27
+ import '../chunk-MSUW5VHZ.js';