@rzl-zone/utils-js 3.13.1-beta.0 → 3.14.0-beta.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 (281) hide show
  1. package/README.md +7 -6
  2. package/dist/.references/index.d.cts +2 -1
  3. package/dist/.references/index.d.ts +2 -1
  4. package/dist/AbortError-DK6kpzbu.cjs +26 -0
  5. package/dist/AbortError-DK6kpzbu.cjs.map +1 -0
  6. package/dist/AbortError-DVT8lAKn.js +20 -0
  7. package/dist/AbortError-DVT8lAKn.js.map +1 -0
  8. package/dist/{assertIsArray-DrLORH0Y.js → assertIsArray-CG7L7vlt.js} +3 -3
  9. package/dist/assertIsArray-CG7L7vlt.js.map +1 -0
  10. package/dist/{assertIsArray-CqIFmlgj.cjs → assertIsArray-CtCRD-_G.cjs} +5 -5
  11. package/dist/assertIsArray-CtCRD-_G.cjs.map +1 -0
  12. package/dist/assertIsPlainObject-DPZLj-Ho.cjs +26 -0
  13. package/dist/assertIsPlainObject-DPZLj-Ho.cjs.map +1 -0
  14. package/dist/assertIsPlainObject-j9bDqNLo.js +20 -0
  15. package/dist/assertIsPlainObject-j9bDqNLo.js.map +1 -0
  16. package/dist/{assertIsString-1iLqxrN0.js → assertIsString-CHIwE12y.js} +4 -4
  17. package/dist/assertIsString-CHIwE12y.js.map +1 -0
  18. package/dist/{assertIsString-DGDLC-XD.cjs → assertIsString-CjE9kbQ_.cjs} +6 -6
  19. package/dist/assertIsString-CjE9kbQ_.cjs.map +1 -0
  20. package/dist/assertions/index.cjs +14 -12
  21. package/dist/assertions/index.cjs.map +1 -1
  22. package/dist/assertions/index.d.cts +2 -2
  23. package/dist/assertions/index.d.ts +2 -2
  24. package/dist/assertions/index.js +10 -8
  25. package/dist/assertions/index.js.map +1 -1
  26. package/dist/conversions/index.cjs +6 -6
  27. package/dist/conversions/index.d.cts +2 -2
  28. package/dist/conversions/index.d.ts +2 -2
  29. package/dist/conversions/index.js +6 -6
  30. package/dist/conversions-BFz6MKaV.cjs +449 -0
  31. package/dist/conversions-BFz6MKaV.cjs.map +1 -0
  32. package/dist/{conversions-CA_3PTAH.js → conversions-Ben5p5Ts.js} +43 -40
  33. package/dist/conversions-Ben5p5Ts.js.map +1 -0
  34. package/dist/errors/index.cjs +13 -0
  35. package/dist/errors/index.d.cts +180 -0
  36. package/dist/errors/index.d.ts +180 -0
  37. package/dist/errors/index.js +11 -0
  38. package/dist/events/index.cjs +10 -9
  39. package/dist/events/index.cjs.map +1 -1
  40. package/dist/events/index.d.cts +185 -100
  41. package/dist/events/index.d.ts +185 -100
  42. package/dist/events/index.js +9 -8
  43. package/dist/events/index.js.map +1 -1
  44. package/dist/formatter-ekJQF_bA-BepnCBkQ.cjs +67 -0
  45. package/dist/formatter-ekJQF_bA-BepnCBkQ.cjs.map +1 -0
  46. package/dist/formatter-ekJQF_bA-xLD9mGk4.js +55 -0
  47. package/dist/formatter-ekJQF_bA-xLD9mGk4.js.map +1 -0
  48. package/dist/formatters/index.cjs +2 -2
  49. package/dist/formatters/index.d.cts +2 -2
  50. package/dist/formatters/index.d.ts +2 -2
  51. package/dist/formatters/index.js +2 -2
  52. package/dist/{formatters-Bm3a_akj.js → formatters-BAbGsnYA.js} +78 -71
  53. package/dist/formatters-BAbGsnYA.js.map +1 -0
  54. package/dist/formatters-zd0Gs4Cs.cjs +436 -0
  55. package/dist/formatters-zd0Gs4Cs.cjs.map +1 -0
  56. package/dist/generators/index.cjs +37 -31
  57. package/dist/generators/index.cjs.map +1 -1
  58. package/dist/generators/index.d.cts +2 -2
  59. package/dist/generators/index.d.ts +2 -2
  60. package/dist/generators/index.js +29 -23
  61. package/dist/generators/index.js.map +1 -1
  62. package/dist/hasOwnProp-CVIhlD1i.js +47 -0
  63. package/dist/hasOwnProp-CVIhlD1i.js.map +1 -0
  64. package/dist/hasOwnProp-D9Tpgokd.cjs +53 -0
  65. package/dist/hasOwnProp-D9Tpgokd.cjs.map +1 -0
  66. package/dist/{index-CakviK5E.d.cts → index-9JsU_wMu.d.ts} +1375 -937
  67. package/dist/{index-BqkYm8qT.d.ts → index-BP3sUrAx.d.ts} +242 -133
  68. package/dist/{index-CJx0EFQ4.d.cts → index-BVovC-yK.d.cts} +229 -200
  69. package/dist/index-C1X6ha9s.d.cts +1041 -0
  70. package/dist/index-CcPQZ41G.d.cts +1103 -0
  71. package/dist/index-CjpbuJF4.d.ts +2424 -0
  72. package/dist/index-CssrQyHh.d.cts +2424 -0
  73. package/dist/index-DZHiYYR7.d.cts +2179 -0
  74. package/dist/index-DZHiYYR7.d.ts +2179 -0
  75. package/dist/index-DlyDmXUo.d.ts +1103 -0
  76. package/dist/index-Dm4a___O.d.ts +1041 -0
  77. package/dist/{index-D5nTp1kV.d.ts → index-Dwduk7ez.d.cts} +1375 -937
  78. package/dist/{index-uaHl0X-r.d.cts → index-I5V6RbZM.d.cts} +1592 -790
  79. package/dist/{index-Bm5odgLW.d.ts → index-hOqBIL7F.d.ts} +1592 -790
  80. package/dist/{index-hOCUw-B9.d.ts → index-jyuOZMX7.d.ts} +229 -200
  81. package/dist/{index-BqkYm8qT.d.cts → index-lI0b7iUz.d.cts} +242 -133
  82. package/dist/{isBigInt-f6yY2fAV.js → isBigInt-Cez32M69.js} +2 -2
  83. package/dist/isBigInt-Cez32M69.js.map +1 -0
  84. package/dist/{isBigInt-CqZNWVtI.cjs → isBigInt-YgpNKTbA.cjs} +2 -2
  85. package/dist/isBigInt-YgpNKTbA.cjs.map +1 -0
  86. package/dist/{isEmptyString-Ga77_3Q1.js → isEmptyString-C9QLWjx2.js} +4 -4
  87. package/dist/isEmptyString-C9QLWjx2.js.map +1 -0
  88. package/dist/{isEmptyString-DNMPmS-H.cjs → isEmptyString-O4TFe1Ao.cjs} +5 -5
  89. package/dist/isEmptyString-O4TFe1Ao.cjs.map +1 -0
  90. package/dist/isEmptyValue-CFExALXZ.cjs +54 -0
  91. package/dist/isEmptyValue-CFExALXZ.cjs.map +1 -0
  92. package/dist/isEmptyValue-kCjnLjbN.js +36 -0
  93. package/dist/isEmptyValue-kCjnLjbN.js.map +1 -0
  94. package/dist/{isFinite-Crw95XV8.cjs → isFinite-B_hHbDpa.cjs} +6 -6
  95. package/dist/isFinite-B_hHbDpa.cjs.map +1 -0
  96. package/dist/{isFinite-BJO7Dt6B.js → isFinite-ZvNhyHlF.js} +5 -5
  97. package/dist/isFinite-ZvNhyHlF.js.map +1 -0
  98. package/dist/{isInteger-B75voxys.js → isInteger-aZgzTTZG.js} +4 -4
  99. package/dist/isInteger-aZgzTTZG.js.map +1 -0
  100. package/dist/{isInteger-CSMNm--9.cjs → isInteger-dnc6W63Z.cjs} +4 -4
  101. package/dist/isInteger-dnc6W63Z.cjs.map +1 -0
  102. package/dist/isNumber-BCWD4dW0.js +20 -0
  103. package/dist/isNumber-BCWD4dW0.js.map +1 -0
  104. package/dist/isNumber-BkzwAe50.cjs +26 -0
  105. package/dist/isNumber-BkzwAe50.cjs.map +1 -0
  106. package/dist/isPlainObject-CAe_ElKO.d.cts +331 -0
  107. package/dist/isPlainObject-CJvRG4Je.d.ts +331 -0
  108. package/dist/{isServer-BHOSvBhV.js → isServer-CQzrX5e0.js} +2 -2
  109. package/dist/isServer-CQzrX5e0.js.map +1 -0
  110. package/dist/{isServer-HA13Dzo2.cjs → isServer-DhFaedeT.cjs} +2 -2
  111. package/dist/isServer-DhFaedeT.cjs.map +1 -0
  112. package/dist/{isEqual-D8W3Wizi.cjs → isTypedArray-DjADSu8q.cjs} +45 -13
  113. package/dist/isTypedArray-DjADSu8q.cjs.map +1 -0
  114. package/dist/{isEqual-ekId-j5b.js → isTypedArray-DxsPKrLh.js} +29 -9
  115. package/dist/isTypedArray-DxsPKrLh.js.map +1 -0
  116. package/dist/{isValidDomain-BqyLVi7S.js → isValidDomain-CDtNOhMc.js} +13 -54
  117. package/dist/isValidDomain-CDtNOhMc.js.map +1 -0
  118. package/dist/{isValidDomain-ByrOfQsh.cjs → isValidDomain-D_x7uNIu.cjs} +16 -69
  119. package/dist/isValidDomain-D_x7uNIu.cjs.map +1 -0
  120. package/dist/{assertIsBoolean-DDhQ2D-k.js → logger-CLWnKRKE.js} +657 -587
  121. package/dist/logger-CLWnKRKE.js.map +1 -0
  122. package/dist/{assertIsBoolean-CEx4KbHg.cjs → logger-CUacYy3D.cjs} +658 -612
  123. package/dist/logger-CUacYy3D.cjs.map +1 -0
  124. package/dist/{noop-CkwxErJ2.cjs → noop-CjEbNsJL.cjs} +2 -2
  125. package/dist/noop-CjEbNsJL.cjs.map +1 -0
  126. package/dist/{noop-D_Ots__Z.js → noop-qxrcogt5.js} +2 -2
  127. package/dist/noop-qxrcogt5.js.map +1 -0
  128. package/dist/{normalizeSpaces-88yaixiu.cjs → normalizeSpaces-D0_Z4qnO.cjs} +6 -9
  129. package/dist/normalizeSpaces-D0_Z4qnO.cjs.map +1 -0
  130. package/dist/{normalizeSpaces-Cat8CHtt.js → normalizeSpaces-DAsxzBEQ.js} +4 -7
  131. package/dist/normalizeSpaces-DAsxzBEQ.js.map +1 -0
  132. package/dist/operations/index.cjs +152 -22
  133. package/dist/operations/index.cjs.map +1 -1
  134. package/dist/operations/index.d.cts +257 -35
  135. package/dist/operations/index.d.ts +257 -35
  136. package/dist/operations/index.js +142 -13
  137. package/dist/operations/index.js.map +1 -1
  138. package/dist/parsers/index.cjs +2 -2
  139. package/dist/parsers/index.d.cts +238 -180
  140. package/dist/parsers/index.d.ts +238 -180
  141. package/dist/parsers/index.js +2 -2
  142. package/dist/{parsers-BLHzVoh-.js → parsers-BBAE_xVM.js} +9 -8
  143. package/dist/parsers-BBAE_xVM.js.map +1 -0
  144. package/dist/{parsers-xAQmKCgS.cjs → parsers-i8WEeMJl.cjs} +10 -9
  145. package/dist/parsers-i8WEeMJl.cjs.map +1 -0
  146. package/dist/{parsing-BYo6U0EG.js → parsing-D9tbKQ0v.js} +3 -3
  147. package/dist/parsing-D9tbKQ0v.js.map +1 -0
  148. package/dist/{parsing-CuezVd0e.cjs → parsing-DGjB8cwr.cjs} +4 -4
  149. package/dist/parsing-DGjB8cwr.cjs.map +1 -0
  150. package/dist/predicates/index.cjs +43 -43
  151. package/dist/predicates/index.d.cts +3 -3
  152. package/dist/predicates/index.d.ts +3 -3
  153. package/dist/predicates/index.js +14 -14
  154. package/dist/{predicates-BMTIIYx8.js → predicates-C0dova7l.js} +45 -40
  155. package/dist/predicates-C0dova7l.js.map +1 -0
  156. package/dist/{predicates-ZmZpelMh.cjs → predicates-Dd7To7B4.cjs} +89 -84
  157. package/dist/predicates-Dd7To7B4.cjs.map +1 -0
  158. package/dist/promises/index.cjs +27 -26
  159. package/dist/promises/index.cjs.map +1 -1
  160. package/dist/promises/index.d.cts +227 -75
  161. package/dist/promises/index.d.ts +227 -75
  162. package/dist/promises/index.js +27 -26
  163. package/dist/promises/index.js.map +1 -1
  164. package/dist/{punyCode-WZ6-GaTM.cjs → punyCode-DHTLhGdD.cjs} +12 -12
  165. package/dist/punyCode-DHTLhGdD.cjs.map +1 -0
  166. package/dist/{punyCode-COTqgXMJ.js → punyCode-Deb1Mrkc.js} +12 -12
  167. package/dist/punyCode-Deb1Mrkc.js.map +1 -0
  168. package/dist/{removeSpaces-CQJvw1yU.js → removeSpaces-BPnsdRN0.js} +4 -4
  169. package/dist/removeSpaces-BPnsdRN0.js.map +1 -0
  170. package/dist/{removeSpaces-BeGkktUl.cjs → removeSpaces-CN3pxBz_.cjs} +7 -7
  171. package/dist/removeSpaces-CN3pxBz_.cjs.map +1 -0
  172. package/dist/rzl-utils.global.js +13 -13
  173. package/dist/safeJsonParse-D1FLVTEM.cjs +209 -0
  174. package/dist/safeJsonParse-D1FLVTEM.cjs.map +1 -0
  175. package/dist/{safeJsonParse-D8H3wCv7.js → safeJsonParse-DEVKNDSn.js} +29 -28
  176. package/dist/safeJsonParse-DEVKNDSn.js.map +1 -0
  177. package/dist/safeStableStringify-C5HHKUdn.cjs +125 -0
  178. package/dist/safeStableStringify-C5HHKUdn.cjs.map +1 -0
  179. package/dist/{safeStableStringify-BLwA1VC-.js → safeStableStringify-DfwxmiWn.js} +20 -13
  180. package/dist/safeStableStringify-DfwxmiWn.js.map +1 -0
  181. package/dist/strings/index.cjs +26 -30
  182. package/dist/strings/index.cjs.map +1 -1
  183. package/dist/strings/index.d.cts +2 -2
  184. package/dist/strings/index.d.ts +2 -2
  185. package/dist/strings/index.js +13 -17
  186. package/dist/strings/index.js.map +1 -1
  187. package/dist/tailwind/index.cjs +3 -3
  188. package/dist/tailwind/index.d.cts +3 -3
  189. package/dist/tailwind/index.d.ts +3 -3
  190. package/dist/tailwind/index.js +3 -3
  191. package/dist/{tailwind-CjxdO7aL.cjs → tailwind-BG7B0cDs.cjs} +59 -53
  192. package/dist/tailwind-BG7B0cDs.cjs.map +1 -0
  193. package/dist/{tailwind-RSE3obLb.js → tailwind-tJNnFPsF.js} +38 -32
  194. package/dist/tailwind-tJNnFPsF.js.map +1 -0
  195. package/dist/{toStringArrayUnRecursive-NreW1dyV.js → toStringArrayUnRecursive-D0WbLIRz.js} +9 -9
  196. package/dist/toStringArrayUnRecursive-D0WbLIRz.js.map +1 -0
  197. package/dist/toStringArrayUnRecursive-QLoaNX_-.cjs +51 -0
  198. package/dist/toStringArrayUnRecursive-QLoaNX_-.cjs.map +1 -0
  199. package/dist/urls/index.cjs +3 -3
  200. package/dist/urls/index.d.cts +635 -443
  201. package/dist/urls/index.d.ts +635 -443
  202. package/dist/urls/index.js +3 -3
  203. package/dist/{urls-CLVfEB7O.js → urls-EoWslGgg.js} +50 -41
  204. package/dist/urls-EoWslGgg.js.map +1 -0
  205. package/dist/urls-NCzPepe2.cjs +308 -0
  206. package/dist/urls-NCzPepe2.cjs.map +1 -0
  207. package/package.json +6 -6
  208. package/dist/assertIsArray-CqIFmlgj.cjs.map +0 -1
  209. package/dist/assertIsArray-DrLORH0Y.js.map +0 -1
  210. package/dist/assertIsBoolean-CEx4KbHg.cjs.map +0 -1
  211. package/dist/assertIsBoolean-DDhQ2D-k.js.map +0 -1
  212. package/dist/assertIsString-1iLqxrN0.js.map +0 -1
  213. package/dist/assertIsString-DGDLC-XD.cjs.map +0 -1
  214. package/dist/conversions-Bxa01uIl.cjs +0 -446
  215. package/dist/conversions-Bxa01uIl.cjs.map +0 -1
  216. package/dist/conversions-CA_3PTAH.js.map +0 -1
  217. package/dist/formatters-Bm3a_akj.js.map +0 -1
  218. package/dist/formatters-Bt6QuhxK.cjs +0 -429
  219. package/dist/formatters-Bt6QuhxK.cjs.map +0 -1
  220. package/dist/index--h04HuBE.d.cts +0 -765
  221. package/dist/index--h04HuBE.d.ts +0 -765
  222. package/dist/index-Ap8U-8Qx.d.cts +0 -947
  223. package/dist/index-BAeeggeh.d.cts +0 -1716
  224. package/dist/index-BAeeggeh.d.ts +0 -1716
  225. package/dist/index-CMglhpFG.d.ts +0 -947
  226. package/dist/isBigInt-CqZNWVtI.cjs.map +0 -1
  227. package/dist/isBigInt-f6yY2fAV.js.map +0 -1
  228. package/dist/isEmptyObject-BYNnSKzw.js +0 -25
  229. package/dist/isEmptyObject-BYNnSKzw.js.map +0 -1
  230. package/dist/isEmptyObject-C2lQyFZS.cjs +0 -37
  231. package/dist/isEmptyObject-C2lQyFZS.cjs.map +0 -1
  232. package/dist/isEmptyString-DNMPmS-H.cjs.map +0 -1
  233. package/dist/isEmptyString-Ga77_3Q1.js.map +0 -1
  234. package/dist/isEmptyValue-D7-6WWS9.js +0 -24
  235. package/dist/isEmptyValue-D7-6WWS9.js.map +0 -1
  236. package/dist/isEmptyValue-DZaDHEIw.cjs +0 -30
  237. package/dist/isEmptyValue-DZaDHEIw.cjs.map +0 -1
  238. package/dist/isEqual-D8W3Wizi.cjs.map +0 -1
  239. package/dist/isEqual-ekId-j5b.js.map +0 -1
  240. package/dist/isFinite-BJO7Dt6B.js.map +0 -1
  241. package/dist/isFinite-Crw95XV8.cjs.map +0 -1
  242. package/dist/isInteger-B75voxys.js.map +0 -1
  243. package/dist/isInteger-CSMNm--9.cjs.map +0 -1
  244. package/dist/isPlainObject-ByfuseCf.d.cts +0 -339
  245. package/dist/isPlainObject-ByfuseCf.d.ts +0 -339
  246. package/dist/isServer-BHOSvBhV.js.map +0 -1
  247. package/dist/isServer-HA13Dzo2.cjs.map +0 -1
  248. package/dist/isTypedArray-CWlHRz_O.cjs +0 -43
  249. package/dist/isTypedArray-CWlHRz_O.cjs.map +0 -1
  250. package/dist/isTypedArray-CmnQ7Yx9.js +0 -31
  251. package/dist/isTypedArray-CmnQ7Yx9.js.map +0 -1
  252. package/dist/isValidDomain-BqyLVi7S.js.map +0 -1
  253. package/dist/isValidDomain-ByrOfQsh.cjs.map +0 -1
  254. package/dist/noop-CkwxErJ2.cjs.map +0 -1
  255. package/dist/noop-D_Ots__Z.js.map +0 -1
  256. package/dist/normalizeSpaces-88yaixiu.cjs.map +0 -1
  257. package/dist/normalizeSpaces-Cat8CHtt.js.map +0 -1
  258. package/dist/parsers-BLHzVoh-.js.map +0 -1
  259. package/dist/parsers-xAQmKCgS.cjs.map +0 -1
  260. package/dist/parsing-BYo6U0EG.js.map +0 -1
  261. package/dist/parsing-CuezVd0e.cjs.map +0 -1
  262. package/dist/predicates-BMTIIYx8.js.map +0 -1
  263. package/dist/predicates-ZmZpelMh.cjs.map +0 -1
  264. package/dist/punyCode-COTqgXMJ.js.map +0 -1
  265. package/dist/punyCode-WZ6-GaTM.cjs.map +0 -1
  266. package/dist/removeSpaces-BeGkktUl.cjs.map +0 -1
  267. package/dist/removeSpaces-CQJvw1yU.js.map +0 -1
  268. package/dist/safeJsonParse-BznDD3fi.cjs +0 -208
  269. package/dist/safeJsonParse-BznDD3fi.cjs.map +0 -1
  270. package/dist/safeJsonParse-D8H3wCv7.js.map +0 -1
  271. package/dist/safeStableStringify-4b-E_UHM.cjs +0 -106
  272. package/dist/safeStableStringify-4b-E_UHM.cjs.map +0 -1
  273. package/dist/safeStableStringify-BLwA1VC-.js.map +0 -1
  274. package/dist/tailwind-CjxdO7aL.cjs.map +0 -1
  275. package/dist/tailwind-RSE3obLb.js.map +0 -1
  276. package/dist/toStringArrayUnRecursive-D-jHROts.cjs +0 -51
  277. package/dist/toStringArrayUnRecursive-D-jHROts.cjs.map +0 -1
  278. package/dist/toStringArrayUnRecursive-NreW1dyV.js.map +0 -1
  279. package/dist/urls-C6BvhrrV.cjs +0 -299
  280. package/dist/urls-C6BvhrrV.cjs.map +0 -1
  281. package/dist/urls-CLVfEB7O.js.map +0 -1
@@ -2,231 +2,289 @@
2
2
  * ========================================================================
3
3
  * @rzl-zone/utils-js
4
4
  * ------------------------------------------------------------------------
5
- * Version: `3.13.1-beta.0`
5
+ * Version: `3.14.0-beta.0`
6
6
  * Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
7
7
  * Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
8
8
  * ========================================================================
9
9
  */
10
10
  type ExtractFileNameOptions = {
11
- /** ----------------------------------------------------------
11
+ /** ------------------------------------------------------------------------------------
12
12
  * * ***Indicates whether the input should be treated as a potential domain string.***
13
- * ----------------------------------------------------------
13
+ * -------------------------------------------------------------------------------------
14
14
  *
15
15
  * - Behavior when `true`:
16
- * - The `domainName` option is required and must be a string and non-empty string.
17
- * If `domainName` is `undefined`, `null`, or an empty string, a `TypeError` will be thrown.
18
- * - The `domainName` is used to determine if the input is a domain-only string.
19
- * - Returns `null` if the input exactly matches `domainName` or any of its subdomains **and** has no additional path or filename.
20
- * - If the input does not match `domainName` or its subdomains, it will be processed as a regular file-like name.
21
- * - Supports **Unicode/IDN domains** (e.g., `tést-ドメイン.com`) and **ASCII filenames**, mixed safely.
16
+ * - The `domainName` option is required and must be a string and non-empty string.
17
+ * If `domainName` is `undefined`, `null`, or an empty string, a `TypeError` will be thrown.
18
+ * - The `domainName` is used to determine if the input is a domain-only string.
19
+ * - Returns `null` if the input exactly matches `domainName` or any of its subdomains **and** has no additional path or filename.
20
+ * - If the input does not match `domainName` or its subdomains, it will be processed as a regular file-like name.
21
+ * - Supports **Unicode/IDN domains** (e.g., `tést-ドメイン.com`) and **ASCII filenames**, mixed safely.
22
22
  *
23
+ * ---
23
24
  * @default false
24
25
  */
25
26
  domainAware?: boolean;
26
- /** ----------------------------------------------------------
27
+ /** ------------------------------------------------------------------------------------
27
28
  * * ***The base domain name used for comparison (e.g., `"example.com"`).***
28
- * ----------------------------------------------------------
29
+ * -------------------------------------------------------------------------------------
29
30
  *
30
31
  * - Required when `domainAware` is `true`.
31
- * - Helps differentiate between a domain-only input (ignored) and a standalone file-like string (processed normally).
32
- * - Must be a string and non-empty string. Invalid values (`undefined`, `null`, or empty string) will trigger a `TypeError`.
33
- * - Works with both **ASCII domains** and **Unicode/IDN domains**.
34
- * - Example:
35
- * ```ts *
36
- * // ASCII domain + ASCII filename
37
- * extractFileName("resume.com", {
38
- * domainAware: true,
39
- * domainName: "example.com"
40
- * });
41
- * // ➔ "resume"
42
- * extractFileName("example.com", {
43
- * domainAware: true,
44
- * domainName: "example.com"
45
- * });
46
- * // ➔ null (because input is treated as domain-name)
32
+ * - Helps differentiate between a domain-only input (ignored) and a standalone file-like string (processed normally).
33
+ * - Must be a string and non-empty string. Invalid values (`undefined`, `null`, or empty string) will trigger a `TypeError`.
34
+ * - Works with both **ASCII domains** and **Unicode/IDN domains**.
35
+ * - Example:
36
+ * ```ts
37
+ * // ASCII domain + ASCII filename
38
+ * extractFileName("resume.com", {
39
+ * domainAware: true,
40
+ * domainName: "example.com"
41
+ * });
42
+ * // ➔ "resume"
43
+ * extractFileName("example.com", {
44
+ * domainAware: true,
45
+ * domainName: "example.com"
46
+ * });
47
+ * // ➔ null (because input is treated as domain-name)
47
48
  *
48
- * // Unicode domain + ASCII filename
49
- * extractFileName("tést-ドメイン.com/file.txt", {
50
- * domainAware: true,
51
- * domainName: "ドメイン.com"
52
- * });
53
- * // ➔ "file"
49
+ * // Unicode domain + ASCII filename
50
+ * extractFileName("tést-ドメイン.com/file.txt", {
51
+ * domainAware: true,
52
+ * domainName: "ドメイン.com"
53
+ * });
54
+ * // ➔ "file"
54
55
  *
55
- * // Unicode domain + Unicode filename
56
- * extractFileName("tést-ドメイン.com/ファイル名.pdf", {
57
- * domainAware: true,
58
- * domainName: "ドメイン.com"
59
- * });
60
- * // ➔ "ファイル名"
56
+ * // Unicode domain + Unicode filename
57
+ * extractFileName("tést-ドメイン.com/ファイル名.pdf", {
58
+ * domainAware: true,
59
+ * domainName: "ドメイン.com"
60
+ * });
61
+ * // ➔ "ファイル名"
61
62
  *
62
- * // Invalid domainName, will throw TypeError
63
- * extractFileName("resume.com", {
64
- * domainAware: true,
65
- * domainName: ""
66
- * });
67
- * // ➔ TypeError
68
- * ```
63
+ * // Invalid domainName, will throw TypeError
64
+ * extractFileName("resume.com", {
65
+ * domainAware: true,
66
+ * domainName: ""
67
+ * });
68
+ * // ➔ TypeError
69
+ * ```
69
70
  *
71
+ * ---
70
72
  * @default undefined
71
73
  */
72
74
  domainName?: string;
73
75
  };
74
- /** ----------------------------------------------------------
76
+ /** ------------------------------------------------------------------------------------
75
77
  * * ***Utility: `extractFileName`.***
76
- * ----------------------------------------------------------
77
- *
78
+ * -------------------------------------------------------------------------------------
78
79
  * **Extracts the **clean base filename** from nearly any input string, including URLs, local file paths,
79
80
  * UNC paths, and plain filenames.**
80
81
  *
82
+ * ---
81
83
  * - It automatically safely handles extracts the **base file name** (without extension) from:
82
- * - File system paths (Windows, Unix, UNC)
83
- * - Protocols like http, https, ftp, file, mailto, or custom schemes
84
- * - Percent-encoded, Unicode, and emoji characters
85
- * - Dotfiles, reserved OS names, multi-part extensions
86
- * - Data URIs
87
- * - Optional domain-aware mode to ignore domain-only inputs
88
- * - Plain filenames
84
+ * - File system paths (Windows, Unix, UNC).
85
+ * - Protocols like http, https, ftp, file, mailto, or custom schemes.
86
+ * - Percent-encoded, Unicode, and emoji characters.
87
+ * - Dotfiles, reserved OS names, multi-part extensions.
88
+ * - Data URIs.
89
+ * - Optional domain-aware mode to ignore domain-only inputs.
90
+ * - Plain filenames.
89
91
  *
92
+ * ---
90
93
  * - Full support for:
91
- * - Unicode, emoji, percent-encoding
92
- * - Dotfiles (e.g., `.env`, `.gitignore`)
93
- * - Reserved/OS-protected filenames:
94
- * `CON`, `PRN`, `AUX`, `NUL`, `COM1`–`COM9`, `LPT1`–`LPT9`
95
- * - Known multi-part extensions:
96
- * `.tar.gz`, `.tar.bz2`, `.tar.xz`, `.tar.lz`, `.tar.zst`, `.min.js`, `.js.map`, `.log.gz`, `.sql.gz`,
97
- * `.backup.tar`, etc.
98
- * - Data URIs (`data:[mime];base64,...` ➔ payload string)
99
- * - Domain-aware mode (optional)
94
+ * - Unicode, emoji, percent-encoding.
95
+ * - Dotfiles (e.g., `.env`, `.gitignore`).
96
+ * - Reserved/OS-protected filenames:
97
+ * `CON`, `PRN`, `AUX`, `NUL`, `COM1`~`COM9`, `LPT1`~`LPT9`.
98
+ * - Known multi-part extensions:
99
+ * `.tar.gz`, `.tar.bz2`, `.tar.xz`, `.tar.lz`, `.tar.zst`, `.min.js`, `.js.map`, `.log.gz`, `.sql.gz`,
100
+ * `.backup.tar`, etc.
101
+ * - Data URIs (`data:[mime];base64,...` ➔ payload string).
102
+ * - Domain-aware mode (optional).
100
103
  *
101
- * ----------------------------------------------------------
104
+ * ---
102
105
  * - **Behavior / Features**
103
- * - Strips **known extensions**, including multi-part and common double/triple extensions.
104
- * - Leaves unknown/custom extensions intact.
105
- * - Preserves **dotfiles** as-is (leading dot preserved).
106
- * - Returns `null` if:
107
- * - input is `null`, `undefined`, or not a string
108
- * - input is empty, whitespace-only, or only slashes
109
- * - input represents a folder path (trailing slash/backslash, drive/folder only)
110
- * - input is a **domain-only string** in domain-aware mode
111
- * - Normalizes Windows-style backslashes (`\`) internally as `/`.
112
- * - Supports UNC paths, mixed slashes, and Windows drive letters safely.
113
- * - Handles URLs:
114
- * - Ignores query strings (`?v=1.2.3`) and hash fragments (`#section`)
115
- * - Decodes percent-encoded filenames (`my%20file.txt` ➔ `my file.txt`)
116
- * - Supports protocol-relative URLs (`//cdn.example.com/file.jpg`)
117
- * - Supports uncommon/custom protocols (`ftp://`, `file://`, `mailto:`, etc.)
118
- * - Handles **multiple dots**, **trailing dots**, **triple or more extensions**
119
- * - Supports filenames on mixed Unicode/ASCII domains:
120
- * - Domain names can include Unicode characters (IDN / punycode)
121
- * - Filenames may contain ASCII, Unicode, and emoji characters
122
- * - Works correctly when domain is Unicode and filename is ASCII, or vice versa
123
- * - Supports extremely long filenames safely (up to OS limits)
124
- * - Domain-aware mode (`domainAware: true` + `domainName`):
125
- * - Parameter `domainName` must be a string and non-empty string; otherwise a TypeError is thrown.
126
- * - Returns `null` if input equals `domainName` or any subdomain with no file path
127
- * - Extracts filename normally if path/file exists on domain or other domain
128
- * - Safe in Node.js and browsers
106
+ * - Strips **known extensions**, including multi-part and common double/triple extensions.
107
+ * - Leaves unknown/custom extensions intact.
108
+ * - Preserves **dotfiles** as-is (leading dot preserved).
109
+ * - Returns `null` if:
110
+ * - input is `null`, `undefined`, or not a string.
111
+ * - input is empty, whitespace-only, or only slashes.
112
+ * - input represents a folder path (trailing slash/backslash, drive/folder only).
113
+ * - input is a **domain-only string** in domain-aware mode.
114
+ * - Normalizes Windows-style backslashes (`\`) internally as `/`.
115
+ * - Supports UNC paths, mixed slashes, and Windows drive letters safely.
116
+ * - Handles URLs:
117
+ * - Ignores query strings (`?v=1.2.3`) and hash fragments (`#section`).
118
+ * - Decodes percent-encoded filenames (`my%20file.txt` ➔ `my file.txt`).
119
+ * - Supports protocol-relative URLs (`//cdn.example.com/file.jpg`).
120
+ * - Supports uncommon/custom protocols (`ftp://`, `file://`, `mailto:`, etc.).
121
+ * - Handles **multiple dots**, **trailing dots**, **triple or more extensions**.
122
+ * - Supports filenames on mixed Unicode/ASCII domains:
123
+ * - Domain names can include Unicode characters (IDN / punycode).
124
+ * - Filenames may contain ASCII, Unicode, and emoji characters.
125
+ * - Works correctly when domain is Unicode and filename is ASCII, or vice versa.
126
+ * - Supports extremely long filenames safely (up to OS limits).
127
+ * - Domain-aware mode (`domainAware: true` + `domainName`):
128
+ * - Parameter `domainName` must be a string and non-empty string; otherwise a TypeError is thrown.
129
+ * - Returns `null` if input equals `domainName` or any subdomain with no file path.
130
+ * - Extracts filename normally if path/file exists on domain or other domain.
131
+ * - Safe in Node.js and browsers.
129
132
  *
130
- * ----------------------------------------------------------
133
+ * ---
131
134
  * @param {string | null | undefined} input
132
135
  * URL, file path, or plain filename to extract from.
133
136
  *
134
137
  * @param {ExtractFileNameOptions} [options]
135
138
  * Optional configuration:
136
- * - `domainAware?: boolean` – treat input as a domain string. Requires `domainName` to be a string and non-empty string; otherwise, a TypeError is thrown.
137
- * - `domainName?: string` – base domain for comparison eg (`example.com`), required when `domainAware` is true.
139
+ * - `domainAware?: boolean` – Treat input as a domain string. Requires `domainName` to be a string and non-empty string; otherwise, a TypeError is thrown.
140
+ * - `domainName?: string` – Base domain for comparison eg (`example.com`), required when `domainAware` is true.
138
141
  *
142
+ * ---
139
143
  * @returns {string | null}
140
144
  * - Base filename without known extensions
141
145
  * - Original filename if extension unknown
142
146
  * - `null` for invalid inputs, folder paths, or domain-only strings
143
147
  *
144
- * ----------------------------------------------------------
148
+ * ---
145
149
  * @example
146
- * ```ts
147
- * // Basic files
148
- * extractFileName("document.pdf"); // ➔ "document"
149
- * extractFileName("/files/archive.tar.gz"); // ➔ "archive"
150
- * extractFileName("C:\\path\\file.txt"); // ➔ "file"
151
- * extractFileName(".env"); // ➔ ".env"
152
- * extractFileName("folder/"); // ➔ null
153
- *
154
- * // Not a file
155
- * extractFileName("not-file"); // ➔ null
156
- * extractFileName("not-file/"); // ➔ null
157
- * extractFileName("/not-file/"); // ➔ null
158
- * extractFileName("/not-file"); // ➔ null
159
- *
160
- * // URLs with queries, hashes, protocols
161
- * extractFileName("https://example.com/file.txt?ver=1"); // ➔ "file"
162
- * extractFileName("https://example.com/archive.tar.gz#part"); // ➔ "archive"
163
- * extractFileName("//cdn.example.com/image.png"); // "image"
164
- *
165
- *
166
- * // Special protocol handling
167
- * extractFileName("tel:+6212345678"); // ➔ "+6212345678"
168
- * extractFileName("sms:+6212345678"); // ➔ "+6212345678"
169
- * extractFileName("mailto:user@domain.com"); // ➔ "user@domain"
170
- * extractFileName("data:text/plain;base64,SGVsbG8="); // ➔ "SGVsbG8="
171
- * extractFileName("mailto:resume.com"); // ➔ "resume"
172
- * extractFileName("ftp://example.com/image.jpeg"); // "image"
173
- * extractFileName("ftp://files.example.com/app.min.js"); // ➔ "app.min"
174
- * extractFileName("file:///C:/path/to/document.pdf"); // ➔ "document"
175
- * extractFileName("custom-scheme://example.com/video.mp4"); // ➔ "video"
176
- *
177
- * // Unicode & emoji
178
- * extractFileName("emoji-😊.png"); // ➔ "emoji-😊"
179
- * extractFileName("🔥project.tar.gz"); // ➔ "🔥project"
180
- *
181
- * // Dotfiles
182
- * extractFileName(".gitignore"); // ".gitignore"
183
- * extractFileName("/path/.bashrc"); // ➔ ".bashrc"
184
- *
185
- * // Mixed Unicode domain and ASCII filename
186
- * extractFileName("https://tést-ドメイン.com/file.txt"); // ➔ "file"
187
- * extractFileName("https://example.com/ファイル名.pdf"); // ➔ "ファイル名"
188
- * extractFileName("https://ドメイン例.com/emoji-🔥.png"); // ➔ "emoji-🔥"
189
- *
190
- * // Reserved filenames
191
- * extractFileName("CON"); // ➔ "CON"
192
- * extractFileName("NUL.txt"); // ➔ "NUL"
193
- *
194
- * // Domain-aware mode
195
- * extractFileName("example.com", {
196
- * domainAware: true,
197
- * domainName: "example.com"
198
- * });
199
- * // ➔ null
200
- * extractFileName("cdn.example.com", {
201
- * domainAware: true,
202
- * domainName: "example.com"
203
- * });
204
- * // null
205
- * extractFileName("resume.com", {
206
- * domainAware: true,
207
- * domainName: "example.com"
208
- * });
209
- * // ➔ "resume"
210
- * extractFileName("https://example.com/file.txt", {
211
- * domainAware: true,
212
- * domainName: "example.com"
213
- * });
214
- * // ➔ "file"
215
- *
216
- * // Windows & UNC paths
217
- * extractFileName("C:\\Users\\rzl\\Documents\\file.txt"); // ➔ "file"
218
- * extractFileName("\\\\SERVER\\share\\logs\\output.log"); // ➔ "output"
219
- * extractFileName("C:/Users\\rzl/mix\\test.pdf"); // "test"
220
- *
221
- * // Edge / extreme cases
222
- * extractFileName("https://example.com/my%20file%20name.txt"); // ➔ "my file name"
223
- * extractFileName("app.min.js.map"); // ➔ "app.min"
224
- * extractFileName("backup.tar.bak"); // ➔ "backup.tar.bak" (unknown double extension)
225
- * extractFileName("filename."); // ➔ "filename."
226
- * extractFileName("a".repeat(255) + ".txt"); // ➔ "a".repeat(255)
227
- * ```
228
- *
229
- * ----------------------------------------------------------
150
+ * 1. #### Basic files:
151
+ * ```ts
152
+ * extractFileName("document.pdf");
153
+ * // ➔ "document"
154
+ * extractFileName("/files/archive.tar.gz");
155
+ * // ➔ "archive"
156
+ * extractFileName("C:\\path\\file.txt");
157
+ * // ➔ "file"
158
+ * extractFileName(".env");
159
+ * // ➔ ".env"
160
+ * extractFileName("folder/");
161
+ * // ➔ null
162
+ * ```
163
+ * ---
164
+ * 2. #### Not a file:
165
+ * ```ts
166
+ * extractFileName("not-file");
167
+ * // ➔ null
168
+ * extractFileName("not-file/");
169
+ * // ➔ null
170
+ * extractFileName("/not-file/");
171
+ * // ➔ null
172
+ * extractFileName("/not-file");
173
+ * // ➔ null
174
+ * ```
175
+ * ---
176
+ * 3. #### URLs with `queries`, `hashes`, `protocols`:
177
+ * ```ts
178
+ * extractFileName("https://example.com/file.txt?ver=1");
179
+ * // ➔ "file"
180
+ * extractFileName("https://example.com/archive.tar.gz#part");
181
+ * // "archive"
182
+ * extractFileName("//cdn.example.com/image.png");
183
+ * // ➔ "image"
184
+ * ```
185
+ * ---
186
+ * 4. #### Special protocol handling:
187
+ * ```ts
188
+ * extractFileName("tel:+6212345678");
189
+ * // "+6212345678"
190
+ * extractFileName("sms:+6212345678");
191
+ * // ➔ "+6212345678"
192
+ * extractFileName("mailto:user@domain.com");
193
+ * // ➔ "user@domain"
194
+ * extractFileName("data:text/plain;base64,SGVsbG8=");
195
+ * // ➔ "SGVsbG8="
196
+ * extractFileName("mailto:resume.com");
197
+ * // ➔ "resume"
198
+ * extractFileName("ftp://example.com/image.jpeg");
199
+ * // "image"
200
+ * extractFileName("ftp://files.example.com/app.min.js");
201
+ * // "app.min"
202
+ * extractFileName("file:///C:/path/to/document.pdf");
203
+ * // ➔ "document"
204
+ * extractFileName("custom-scheme://example.com/video.mp4");
205
+ * // ➔ "video"
206
+ * ```
207
+ * ---
208
+ * 5. #### Unicode & emoji:
209
+ * ```ts
210
+ * extractFileName("emoji-😊.png");
211
+ * // "emoji-😊"
212
+ * extractFileName("🔥project.tar.gz");
213
+ * // ➔ "🔥project"
214
+ * ```
215
+ * 6. #### Dotfiles:
216
+ * ```ts
217
+ * extractFileName(".gitignore");
218
+ * // ➔ ".gitignore"
219
+ * extractFileName("/path/.bashrc");
220
+ * // ".bashrc"
221
+ * ```
222
+ * ---
223
+ * 7. #### Mixed Unicode domain and ASCII filename:
224
+ * ```ts
225
+ * extractFileName("https://tést-ドメイン.com/file.txt");
226
+ * // ➔ "file"
227
+ * extractFileName("https://example.com/ファイル名.pdf");
228
+ * // ➔ "ファイル名"
229
+ * extractFileName("https://ドメイン例.com/emoji-🔥.png");
230
+ * // ➔ "emoji-🔥"
231
+ * ```
232
+ * 8. #### Reserved filenames:
233
+ * ```ts
234
+ * extractFileName("CON");
235
+ * // ➔ "CON"
236
+ * extractFileName("NUL.txt");
237
+ * // ➔ "NUL"
238
+ * ```
239
+ * ---
240
+ * 9. #### Domain-aware mode:
241
+ * ```ts
242
+ * extractFileName("example.com", {
243
+ * domainAware: true,
244
+ * domainName: "example.com"
245
+ * });
246
+ * // ➔ null
247
+ * extractFileName("cdn.example.com", {
248
+ * domainAware: true,
249
+ * domainName: "example.com"
250
+ * });
251
+ * // ➔ null
252
+ * extractFileName("resume.com", {
253
+ * domainAware: true,
254
+ * domainName: "example.com"
255
+ * });
256
+ * // ➔ "resume"
257
+ * extractFileName("https://example.com/file.txt", {
258
+ * domainAware: true,
259
+ * domainName: "example.com"
260
+ * });
261
+ * // ➔ "file"
262
+ * ```
263
+ * ---
264
+ * 10. #### Windows & UNC paths:
265
+ * ```ts
266
+ * extractFileName("C:\\Users\\rzl\\Documents\\file.txt");
267
+ * // ➔ "file"
268
+ * extractFileName("\\\\SERVER\\share\\logs\\output.log");
269
+ * // ➔ "output"
270
+ * extractFileName("C:/Users\\rzl/mix\\test.pdf");
271
+ * // ➔ "test"
272
+ * ```
273
+ * ---
274
+ * 11. #### Edge / extreme cases:
275
+ * ```ts
276
+ * extractFileName("https://example.com/my%20file%20name.txt");
277
+ * // ➔ "my file name"
278
+ * extractFileName("app.min.js.map");
279
+ * // ➔ "app.min"
280
+ * extractFileName("backup.tar.bak");
281
+ * // ➔ "backup.tar.bak" (unknown double extension)
282
+ * extractFileName("filename.");
283
+ * // ➔ "filename."
284
+ * extractFileName("a".repeat(255) + ".txt");
285
+ * // ➔ "a".repeat(255)
286
+ * ```
287
+ * ---
230
288
  * @note
231
289
  * - Robust: never throws, handles unusual inputs safely.
232
290
  * - Suitable for display, logging, or safe storage.