ts-data-forge 3.3.0 → 3.3.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 (424) hide show
  1. package/README.md +37 -13
  2. package/dist/array/impl/array-utils-creation.d.mts +116 -0
  3. package/dist/array/impl/array-utils-creation.d.mts.map +1 -0
  4. package/dist/array/impl/array-utils-creation.mjs +110 -0
  5. package/dist/array/impl/array-utils-creation.mjs.map +1 -0
  6. package/dist/array/impl/array-utils-element-access.d.mts +61 -0
  7. package/dist/array/impl/array-utils-element-access.d.mts.map +1 -0
  8. package/dist/array/impl/array-utils-element-access.mjs +66 -0
  9. package/dist/array/impl/array-utils-element-access.mjs.map +1 -0
  10. package/dist/array/impl/array-utils-iterators.d.mts +59 -0
  11. package/dist/array/impl/array-utils-iterators.d.mts.map +1 -0
  12. package/dist/array/impl/array-utils-iterators.mjs +104 -0
  13. package/dist/array/impl/array-utils-iterators.mjs.map +1 -0
  14. package/dist/array/impl/array-utils-modification.d.mts +154 -0
  15. package/dist/array/impl/array-utils-modification.d.mts.map +1 -0
  16. package/dist/array/impl/array-utils-modification.mjs +139 -0
  17. package/dist/array/impl/array-utils-modification.mjs.map +1 -0
  18. package/dist/array/impl/array-utils-reducing-value.d.mts +214 -0
  19. package/dist/array/impl/array-utils-reducing-value.d.mts.map +1 -0
  20. package/dist/array/impl/array-utils-reducing-value.mjs +160 -0
  21. package/dist/array/impl/array-utils-reducing-value.mjs.map +1 -0
  22. package/dist/array/impl/array-utils-search.d.mts +179 -0
  23. package/dist/array/impl/array-utils-search.d.mts.map +1 -0
  24. package/dist/array/impl/array-utils-search.mjs +153 -0
  25. package/dist/array/impl/array-utils-search.mjs.map +1 -0
  26. package/dist/array/impl/array-utils-set-op.d.mts +100 -0
  27. package/dist/array/impl/array-utils-set-op.d.mts.map +1 -0
  28. package/dist/array/impl/array-utils-set-op.mjs +137 -0
  29. package/dist/array/impl/array-utils-set-op.mjs.map +1 -0
  30. package/dist/array/impl/array-utils-size.d.mts +24 -0
  31. package/dist/array/impl/array-utils-size.d.mts.map +1 -0
  32. package/dist/array/impl/array-utils-size.mjs +28 -0
  33. package/dist/array/impl/array-utils-size.mjs.map +1 -0
  34. package/dist/array/impl/array-utils-slice-clamped.d.mts +18 -0
  35. package/dist/array/impl/array-utils-slice-clamped.d.mts.map +1 -0
  36. package/dist/array/impl/array-utils-slice-clamped.mjs +49 -0
  37. package/dist/array/impl/array-utils-slice-clamped.mjs.map +1 -0
  38. package/dist/array/impl/array-utils-slicing.d.mts +120 -0
  39. package/dist/array/impl/array-utils-slicing.d.mts.map +1 -0
  40. package/dist/array/impl/array-utils-slicing.mjs +140 -0
  41. package/dist/array/impl/array-utils-slicing.mjs.map +1 -0
  42. package/dist/array/impl/array-utils-transformation.d.mts +348 -0
  43. package/dist/array/impl/array-utils-transformation.d.mts.map +1 -0
  44. package/dist/array/impl/array-utils-transformation.mjs +331 -0
  45. package/dist/array/impl/array-utils-transformation.mjs.map +1 -0
  46. package/dist/array/impl/array-utils-validation.d.mts +149 -0
  47. package/dist/array/impl/array-utils-validation.d.mts.map +1 -0
  48. package/dist/array/impl/array-utils-validation.mjs +166 -0
  49. package/dist/array/impl/array-utils-validation.mjs.map +1 -0
  50. package/dist/array/impl/index.d.mts +13 -0
  51. package/dist/array/impl/index.d.mts.map +1 -0
  52. package/dist/array/impl/index.mjs +13 -0
  53. package/dist/array/impl/index.mjs.map +1 -0
  54. package/dist/array/index.d.mts +1 -1
  55. package/dist/array/index.d.mts.map +1 -1
  56. package/dist/array/index.mjs +2 -1
  57. package/dist/array/index.mjs.map +1 -1
  58. package/dist/collections/imap-mapped.d.mts +83 -253
  59. package/dist/collections/imap-mapped.d.mts.map +1 -1
  60. package/dist/collections/imap-mapped.mjs +33 -164
  61. package/dist/collections/imap-mapped.mjs.map +1 -1
  62. package/dist/collections/imap.d.mts +436 -163
  63. package/dist/collections/imap.d.mts.map +1 -1
  64. package/dist/collections/imap.mjs +74 -94
  65. package/dist/collections/imap.mjs.map +1 -1
  66. package/dist/collections/iset-mapped.d.mts +828 -345
  67. package/dist/collections/iset-mapped.d.mts.map +1 -1
  68. package/dist/collections/iset-mapped.mjs +200 -242
  69. package/dist/collections/iset-mapped.mjs.map +1 -1
  70. package/dist/collections/iset.d.mts +397 -205
  71. package/dist/collections/iset.d.mts.map +1 -1
  72. package/dist/collections/iset.mjs +102 -184
  73. package/dist/collections/iset.mjs.map +1 -1
  74. package/dist/collections/queue.d.mts +155 -135
  75. package/dist/collections/queue.d.mts.map +1 -1
  76. package/dist/collections/queue.mjs +55 -156
  77. package/dist/collections/queue.mjs.map +1 -1
  78. package/dist/collections/stack.d.mts +154 -154
  79. package/dist/collections/stack.d.mts.map +1 -1
  80. package/dist/collections/stack.mjs +54 -203
  81. package/dist/collections/stack.mjs.map +1 -1
  82. package/dist/entry-point.d.mts +1 -0
  83. package/dist/entry-point.d.mts.map +1 -1
  84. package/dist/entry-point.mjs +2 -1
  85. package/dist/entry-point.mjs.map +1 -1
  86. package/dist/expect-type.d.mts +43 -172
  87. package/dist/expect-type.d.mts.map +1 -1
  88. package/dist/expect-type.mjs +43 -172
  89. package/dist/expect-type.mjs.map +1 -1
  90. package/dist/functional/match.d.mts +35 -140
  91. package/dist/functional/match.d.mts.map +1 -1
  92. package/dist/functional/match.mjs.map +1 -1
  93. package/dist/functional/optional.d.mts +282 -160
  94. package/dist/functional/optional.d.mts.map +1 -1
  95. package/dist/functional/optional.mjs +131 -71
  96. package/dist/functional/optional.mjs.map +1 -1
  97. package/dist/functional/pipe.d.mts +59 -113
  98. package/dist/functional/pipe.d.mts.map +1 -1
  99. package/dist/functional/pipe.mjs.map +1 -1
  100. package/dist/functional/result.d.mts +433 -332
  101. package/dist/functional/result.d.mts.map +1 -1
  102. package/dist/functional/result.mjs +233 -239
  103. package/dist/functional/result.mjs.map +1 -1
  104. package/dist/globals.d.mts +12 -5
  105. package/dist/guard/has-key.d.mts +23 -74
  106. package/dist/guard/has-key.d.mts.map +1 -1
  107. package/dist/guard/has-key.mjs +23 -74
  108. package/dist/guard/has-key.mjs.map +1 -1
  109. package/dist/guard/is-non-empty-string.d.mts +20 -87
  110. package/dist/guard/is-non-empty-string.d.mts.map +1 -1
  111. package/dist/guard/is-non-empty-string.mjs +20 -87
  112. package/dist/guard/is-non-empty-string.mjs.map +1 -1
  113. package/dist/guard/is-non-null-object.d.mts +14 -84
  114. package/dist/guard/is-non-null-object.d.mts.map +1 -1
  115. package/dist/guard/is-non-null-object.mjs +14 -84
  116. package/dist/guard/is-non-null-object.mjs.map +1 -1
  117. package/dist/guard/is-primitive.d.mts +13 -126
  118. package/dist/guard/is-primitive.d.mts.map +1 -1
  119. package/dist/guard/is-primitive.mjs +13 -126
  120. package/dist/guard/is-primitive.mjs.map +1 -1
  121. package/dist/guard/is-record.d.mts +21 -132
  122. package/dist/guard/is-record.d.mts.map +1 -1
  123. package/dist/guard/is-record.mjs +21 -132
  124. package/dist/guard/is-record.mjs.map +1 -1
  125. package/dist/guard/is-type.d.mts +201 -238
  126. package/dist/guard/is-type.d.mts.map +1 -1
  127. package/dist/guard/is-type.mjs +201 -238
  128. package/dist/guard/is-type.mjs.map +1 -1
  129. package/dist/guard/key-is-in.d.mts +22 -139
  130. package/dist/guard/key-is-in.d.mts.map +1 -1
  131. package/dist/guard/key-is-in.mjs +22 -139
  132. package/dist/guard/key-is-in.mjs.map +1 -1
  133. package/dist/index.d.mts +0 -1
  134. package/dist/index.d.mts.map +1 -1
  135. package/dist/index.mjs +0 -1
  136. package/dist/index.mjs.map +1 -1
  137. package/dist/iterator/range.d.mts +29 -62
  138. package/dist/iterator/range.d.mts.map +1 -1
  139. package/dist/iterator/range.mjs.map +1 -1
  140. package/dist/json/json.d.mts +191 -121
  141. package/dist/json/json.d.mts.map +1 -1
  142. package/dist/json/json.mjs +238 -136
  143. package/dist/json/json.mjs.map +1 -1
  144. package/dist/number/branded-types/finite-number.d.mts +24 -156
  145. package/dist/number/branded-types/finite-number.d.mts.map +1 -1
  146. package/dist/number/branded-types/finite-number.mjs +27 -159
  147. package/dist/number/branded-types/finite-number.mjs.map +1 -1
  148. package/dist/number/branded-types/int.d.mts +122 -120
  149. package/dist/number/branded-types/int.d.mts.map +1 -1
  150. package/dist/number/branded-types/int.mjs +122 -120
  151. package/dist/number/branded-types/int.mjs.map +1 -1
  152. package/dist/number/branded-types/int16.d.mts +22 -30
  153. package/dist/number/branded-types/int16.d.mts.map +1 -1
  154. package/dist/number/branded-types/int16.mjs +22 -30
  155. package/dist/number/branded-types/int16.mjs.map +1 -1
  156. package/dist/number/branded-types/int32.d.mts +22 -31
  157. package/dist/number/branded-types/int32.d.mts.map +1 -1
  158. package/dist/number/branded-types/int32.mjs +22 -31
  159. package/dist/number/branded-types/int32.mjs.map +1 -1
  160. package/dist/number/branded-types/non-negative-finite-number.d.mts +28 -36
  161. package/dist/number/branded-types/non-negative-finite-number.d.mts.map +1 -1
  162. package/dist/number/branded-types/non-negative-finite-number.mjs +31 -39
  163. package/dist/number/branded-types/non-negative-finite-number.mjs.map +1 -1
  164. package/dist/number/branded-types/non-negative-int16.d.mts +24 -34
  165. package/dist/number/branded-types/non-negative-int16.d.mts.map +1 -1
  166. package/dist/number/branded-types/non-negative-int16.mjs +24 -34
  167. package/dist/number/branded-types/non-negative-int16.mjs.map +1 -1
  168. package/dist/number/branded-types/non-negative-int32.d.mts +26 -35
  169. package/dist/number/branded-types/non-negative-int32.d.mts.map +1 -1
  170. package/dist/number/branded-types/non-negative-int32.mjs +26 -35
  171. package/dist/number/branded-types/non-negative-int32.mjs.map +1 -1
  172. package/dist/number/branded-types/non-zero-finite-number.d.mts +22 -37
  173. package/dist/number/branded-types/non-zero-finite-number.d.mts.map +1 -1
  174. package/dist/number/branded-types/non-zero-finite-number.mjs +25 -40
  175. package/dist/number/branded-types/non-zero-finite-number.mjs.map +1 -1
  176. package/dist/number/branded-types/non-zero-int.d.mts +15 -30
  177. package/dist/number/branded-types/non-zero-int.d.mts.map +1 -1
  178. package/dist/number/branded-types/non-zero-int.mjs +15 -30
  179. package/dist/number/branded-types/non-zero-int.mjs.map +1 -1
  180. package/dist/number/branded-types/non-zero-int16.d.mts +27 -35
  181. package/dist/number/branded-types/non-zero-int16.d.mts.map +1 -1
  182. package/dist/number/branded-types/non-zero-int16.mjs +27 -35
  183. package/dist/number/branded-types/non-zero-int16.mjs.map +1 -1
  184. package/dist/number/branded-types/non-zero-int32.d.mts +29 -36
  185. package/dist/number/branded-types/non-zero-int32.d.mts.map +1 -1
  186. package/dist/number/branded-types/non-zero-int32.mjs +29 -36
  187. package/dist/number/branded-types/non-zero-int32.mjs.map +1 -1
  188. package/dist/number/branded-types/non-zero-safe-int.d.mts +37 -38
  189. package/dist/number/branded-types/non-zero-safe-int.d.mts.map +1 -1
  190. package/dist/number/branded-types/non-zero-safe-int.mjs +39 -40
  191. package/dist/number/branded-types/non-zero-safe-int.mjs.map +1 -1
  192. package/dist/number/branded-types/non-zero-uint16.d.mts +24 -35
  193. package/dist/number/branded-types/non-zero-uint16.d.mts.map +1 -1
  194. package/dist/number/branded-types/non-zero-uint16.mjs +24 -35
  195. package/dist/number/branded-types/non-zero-uint16.mjs.map +1 -1
  196. package/dist/number/branded-types/non-zero-uint32.d.mts +24 -35
  197. package/dist/number/branded-types/non-zero-uint32.d.mts.map +1 -1
  198. package/dist/number/branded-types/non-zero-uint32.mjs +24 -35
  199. package/dist/number/branded-types/non-zero-uint32.mjs.map +1 -1
  200. package/dist/number/branded-types/positive-finite-number.d.mts +26 -40
  201. package/dist/number/branded-types/positive-finite-number.d.mts.map +1 -1
  202. package/dist/number/branded-types/positive-finite-number.mjs +29 -43
  203. package/dist/number/branded-types/positive-finite-number.mjs.map +1 -1
  204. package/dist/number/branded-types/positive-int.d.mts +133 -123
  205. package/dist/number/branded-types/positive-int.d.mts.map +1 -1
  206. package/dist/number/branded-types/positive-int.mjs +133 -123
  207. package/dist/number/branded-types/positive-int.mjs.map +1 -1
  208. package/dist/number/branded-types/positive-int16.d.mts +24 -35
  209. package/dist/number/branded-types/positive-int16.d.mts.map +1 -1
  210. package/dist/number/branded-types/positive-int16.mjs +24 -35
  211. package/dist/number/branded-types/positive-int16.mjs.map +1 -1
  212. package/dist/number/branded-types/positive-int32.d.mts +24 -35
  213. package/dist/number/branded-types/positive-int32.d.mts.map +1 -1
  214. package/dist/number/branded-types/positive-int32.mjs +24 -35
  215. package/dist/number/branded-types/positive-int32.mjs.map +1 -1
  216. package/dist/number/branded-types/positive-safe-int.d.mts +159 -33
  217. package/dist/number/branded-types/positive-safe-int.d.mts.map +1 -1
  218. package/dist/number/branded-types/positive-safe-int.mjs +160 -34
  219. package/dist/number/branded-types/positive-safe-int.mjs.map +1 -1
  220. package/dist/number/branded-types/positive-uint16.d.mts +24 -35
  221. package/dist/number/branded-types/positive-uint16.d.mts.map +1 -1
  222. package/dist/number/branded-types/positive-uint16.mjs +24 -35
  223. package/dist/number/branded-types/positive-uint16.mjs.map +1 -1
  224. package/dist/number/branded-types/positive-uint32.d.mts +26 -36
  225. package/dist/number/branded-types/positive-uint32.d.mts.map +1 -1
  226. package/dist/number/branded-types/positive-uint32.mjs +26 -36
  227. package/dist/number/branded-types/positive-uint32.mjs.map +1 -1
  228. package/dist/number/branded-types/safe-int.d.mts +140 -99
  229. package/dist/number/branded-types/safe-int.d.mts.map +1 -1
  230. package/dist/number/branded-types/safe-int.mjs +142 -101
  231. package/dist/number/branded-types/safe-int.mjs.map +1 -1
  232. package/dist/number/branded-types/safe-uint.d.mts +24 -33
  233. package/dist/number/branded-types/safe-uint.d.mts.map +1 -1
  234. package/dist/number/branded-types/safe-uint.mjs +25 -34
  235. package/dist/number/branded-types/safe-uint.mjs.map +1 -1
  236. package/dist/number/branded-types/uint.d.mts +121 -30
  237. package/dist/number/branded-types/uint.d.mts.map +1 -1
  238. package/dist/number/branded-types/uint.mjs +121 -30
  239. package/dist/number/branded-types/uint.mjs.map +1 -1
  240. package/dist/number/branded-types/uint16.d.mts +26 -34
  241. package/dist/number/branded-types/uint16.d.mts.map +1 -1
  242. package/dist/number/branded-types/uint16.mjs +26 -34
  243. package/dist/number/branded-types/uint16.mjs.map +1 -1
  244. package/dist/number/branded-types/uint32.d.mts +26 -68
  245. package/dist/number/branded-types/uint32.d.mts.map +1 -1
  246. package/dist/number/branded-types/uint32.mjs +26 -68
  247. package/dist/number/branded-types/uint32.mjs.map +1 -1
  248. package/dist/number/enum/int8.d.mts +37 -101
  249. package/dist/number/enum/int8.d.mts.map +1 -1
  250. package/dist/number/enum/int8.mjs +39 -170
  251. package/dist/number/enum/int8.mjs.map +1 -1
  252. package/dist/number/enum/uint8.d.mts +45 -55
  253. package/dist/number/enum/uint8.d.mts.map +1 -1
  254. package/dist/number/enum/uint8.mjs +46 -155
  255. package/dist/number/enum/uint8.mjs.map +1 -1
  256. package/dist/number/num.d.mts +145 -206
  257. package/dist/number/num.d.mts.map +1 -1
  258. package/dist/number/num.mjs +143 -199
  259. package/dist/number/num.mjs.map +1 -1
  260. package/dist/number/refined-number-utils.d.mts +97 -21
  261. package/dist/number/refined-number-utils.d.mts.map +1 -1
  262. package/dist/number/refined-number-utils.mjs +91 -20
  263. package/dist/number/refined-number-utils.mjs.map +1 -1
  264. package/dist/object/object.d.mts +126 -208
  265. package/dist/object/object.d.mts.map +1 -1
  266. package/dist/object/object.mjs +68 -102
  267. package/dist/object/object.mjs.map +1 -1
  268. package/dist/others/cast-mutable.d.mts +12 -88
  269. package/dist/others/cast-mutable.d.mts.map +1 -1
  270. package/dist/others/cast-mutable.mjs +13 -89
  271. package/dist/others/cast-mutable.mjs.map +1 -1
  272. package/dist/others/cast-readonly.d.mts +12 -168
  273. package/dist/others/cast-readonly.d.mts.map +1 -1
  274. package/dist/others/cast-readonly.mjs +13 -169
  275. package/dist/others/cast-readonly.mjs.map +1 -1
  276. package/dist/others/if-then.d.mts +6 -83
  277. package/dist/others/if-then.d.mts.map +1 -1
  278. package/dist/others/if-then.mjs +6 -83
  279. package/dist/others/if-then.mjs.map +1 -1
  280. package/dist/others/map-nullable.d.mts +12 -136
  281. package/dist/others/map-nullable.d.mts.map +1 -1
  282. package/dist/others/map-nullable.mjs.map +1 -1
  283. package/dist/others/memoize-function.d.mts +14 -157
  284. package/dist/others/memoize-function.d.mts.map +1 -1
  285. package/dist/others/memoize-function.mjs +14 -157
  286. package/dist/others/memoize-function.mjs.map +1 -1
  287. package/dist/others/tuple.d.mts +33 -151
  288. package/dist/others/tuple.d.mts.map +1 -1
  289. package/dist/others/tuple.mjs +33 -151
  290. package/dist/others/tuple.mjs.map +1 -1
  291. package/dist/others/unknown-to-string.d.mts +11 -125
  292. package/dist/others/unknown-to-string.d.mts.map +1 -1
  293. package/dist/others/unknown-to-string.mjs +12 -126
  294. package/dist/others/unknown-to-string.mjs.map +1 -1
  295. package/dist/promise/promise.d.mts +33 -20
  296. package/dist/promise/promise.d.mts.map +1 -1
  297. package/dist/promise/promise.mjs +34 -21
  298. package/dist/promise/promise.mjs.map +1 -1
  299. package/package.json +47 -39
  300. package/src/array/impl/array-utils-creation.mts +192 -0
  301. package/src/array/{array-utils-creation.test.mts → impl/array-utils-creation.test.mts} +121 -72
  302. package/src/array/impl/array-utils-element-access.mts +115 -0
  303. package/src/array/impl/array-utils-element-access.test.mts +151 -0
  304. package/src/array/impl/array-utils-iterators.mts +79 -0
  305. package/src/array/impl/array-utils-iterators.test.mts +98 -0
  306. package/src/array/impl/array-utils-modification.mts +434 -0
  307. package/src/array/{array-utils-modification.test.mts → impl/array-utils-modification.test.mts} +41 -28
  308. package/src/array/{array-utils-overload-type-error.test.mts → impl/array-utils-overload-type-error.test.mts} +33 -33
  309. package/src/array/impl/array-utils-reducing-value.mts +551 -0
  310. package/src/array/{array-utils-reducing-value.test.mts → impl/array-utils-reducing-value.test.mts} +45 -50
  311. package/src/array/impl/array-utils-search.mts +509 -0
  312. package/src/array/impl/array-utils-search.test.mts +346 -0
  313. package/src/array/impl/array-utils-set-op.mts +166 -0
  314. package/src/array/{array-utils-set-op.test.mts → impl/array-utils-set-op.test.mts} +42 -35
  315. package/src/array/impl/array-utils-size.mts +30 -0
  316. package/src/array/impl/array-utils-size.test.mts +9 -0
  317. package/src/array/impl/array-utils-slice-clamped.mts +51 -0
  318. package/src/array/{array-utils-slice-clamped.test.mts → impl/array-utils-slice-clamped.test.mts} +12 -12
  319. package/src/array/impl/array-utils-slicing.mts +275 -0
  320. package/src/array/impl/array-utils-slicing.test.mts +158 -0
  321. package/src/array/impl/array-utils-transformation.mts +746 -0
  322. package/src/array/{array-utils-transformation.test.mts → impl/array-utils-transformation.test.mts} +662 -889
  323. package/src/array/impl/array-utils-validation.mts +241 -0
  324. package/src/array/{array-utils-validation.test.mts → impl/array-utils-validation.test.mts} +194 -107
  325. package/src/array/{array.test.mts → impl/array.test.mts} +2 -2
  326. package/src/array/impl/index.mts +12 -0
  327. package/src/array/index.mts +1 -1
  328. package/src/collections/imap-mapped.mts +99 -265
  329. package/src/collections/imap.mts +477 -174
  330. package/src/collections/imap.test.mts +12 -19
  331. package/src/collections/iset-mapped.mts +892 -358
  332. package/src/collections/iset.mts +429 -213
  333. package/src/collections/queue.mts +174 -200
  334. package/src/collections/stack.mts +172 -245
  335. package/src/collections/stack.test.mts +9 -1
  336. package/src/entry-point.mts +1 -0
  337. package/src/expect-type.mts +43 -172
  338. package/src/functional/match.mts +35 -145
  339. package/src/functional/optional.mts +285 -163
  340. package/src/functional/optional.test.mts +4 -1
  341. package/src/functional/pipe.mts +60 -113
  342. package/src/functional/result.mts +452 -351
  343. package/src/functional/result.test.mts +9 -2
  344. package/src/globals.d.mts +12 -5
  345. package/src/guard/has-key.mts +23 -74
  346. package/src/guard/is-non-empty-string.mts +20 -87
  347. package/src/guard/is-non-null-object.mts +14 -84
  348. package/src/guard/is-non-null-object.test.mts +1 -1
  349. package/src/guard/is-primitive.mts +13 -126
  350. package/src/guard/is-primitive.test.mts +1 -1
  351. package/src/guard/is-record.mts +21 -132
  352. package/src/guard/is-type.mts +201 -238
  353. package/src/guard/is-type.test.mts +7 -7
  354. package/src/guard/key-is-in.mts +22 -139
  355. package/src/index.mts +0 -1
  356. package/src/iterator/range.mts +29 -62
  357. package/src/json/json.mts +202 -134
  358. package/src/json/json.test.mts +1 -3
  359. package/src/number/branded-types/finite-number.mts +27 -159
  360. package/src/number/branded-types/int.mts +122 -120
  361. package/src/number/branded-types/int16.mts +22 -30
  362. package/src/number/branded-types/int16.test.mts +24 -24
  363. package/src/number/branded-types/int32.mts +22 -31
  364. package/src/number/branded-types/int32.test.mts +39 -39
  365. package/src/number/branded-types/non-negative-finite-number.mts +31 -39
  366. package/src/number/branded-types/non-negative-int16.mts +24 -34
  367. package/src/number/branded-types/non-negative-int16.test.mts +16 -16
  368. package/src/number/branded-types/non-negative-int32.mts +26 -35
  369. package/src/number/branded-types/non-negative-int32.test.mts +30 -30
  370. package/src/number/branded-types/non-zero-finite-number.mts +25 -40
  371. package/src/number/branded-types/non-zero-int.mts +15 -30
  372. package/src/number/branded-types/non-zero-int16.mts +27 -35
  373. package/src/number/branded-types/non-zero-int16.test.mts +26 -26
  374. package/src/number/branded-types/non-zero-int32.mts +29 -36
  375. package/src/number/branded-types/non-zero-int32.test.mts +45 -42
  376. package/src/number/branded-types/non-zero-safe-int.mts +39 -40
  377. package/src/number/branded-types/non-zero-uint16.mts +24 -35
  378. package/src/number/branded-types/non-zero-uint16.test.mts +16 -16
  379. package/src/number/branded-types/non-zero-uint32.mts +24 -35
  380. package/src/number/branded-types/non-zero-uint32.test.mts +28 -28
  381. package/src/number/branded-types/positive-finite-number.mts +29 -43
  382. package/src/number/branded-types/positive-int.mts +134 -124
  383. package/src/number/branded-types/positive-int16.mts +24 -35
  384. package/src/number/branded-types/positive-int16.test.mts +14 -14
  385. package/src/number/branded-types/positive-int32.mts +24 -35
  386. package/src/number/branded-types/positive-int32.test.mts +26 -26
  387. package/src/number/branded-types/positive-safe-int.mts +160 -34
  388. package/src/number/branded-types/positive-uint16.mts +24 -35
  389. package/src/number/branded-types/positive-uint16.test.mts +16 -16
  390. package/src/number/branded-types/positive-uint32.mts +26 -36
  391. package/src/number/branded-types/positive-uint32.test.mts +31 -28
  392. package/src/number/branded-types/safe-int.mts +142 -101
  393. package/src/number/branded-types/safe-uint.mts +25 -34
  394. package/src/number/branded-types/uint.mts +121 -30
  395. package/src/number/branded-types/uint16.mts +26 -34
  396. package/src/number/branded-types/uint16.test.mts +16 -16
  397. package/src/number/branded-types/uint32.mts +26 -68
  398. package/src/number/branded-types/uint32.test.mts +28 -28
  399. package/src/number/enum/int8.mts +39 -170
  400. package/src/number/enum/uint8.mts +46 -155
  401. package/src/number/num.mts +157 -212
  402. package/src/number/num.test.mts +4 -4
  403. package/src/number/refined-number-utils.mts +109 -26
  404. package/src/object/object.mts +130 -212
  405. package/src/object/object.test.mts +29 -0
  406. package/src/others/cast-mutable.mts +13 -89
  407. package/src/others/cast-mutable.test.mts +80 -0
  408. package/src/others/cast-readonly.mts +13 -169
  409. package/src/others/if-then.mts +6 -83
  410. package/src/others/map-nullable.mts +12 -136
  411. package/src/others/map-nullable.test.mts +6 -6
  412. package/src/others/memoize-function.mts +14 -157
  413. package/src/others/tuple.mts +33 -151
  414. package/src/others/unknown-to-string.mts +12 -126
  415. package/src/others/unknown-to-string.test.mts +13 -1
  416. package/src/promise/promise.mts +34 -21
  417. package/src/promise/promise.test.mts +43 -0
  418. package/dist/array/array-utils.d.mts +0 -2956
  419. package/dist/array/array-utils.d.mts.map +0 -1
  420. package/dist/array/array-utils.mjs +0 -1838
  421. package/dist/array/array-utils.mjs.map +0 -1
  422. package/src/array/array-utils-search.test.mts +0 -169
  423. package/src/array/array-utils-slicing.test.mts +0 -274
  424. package/src/array/array-utils.mts +0 -4834
@@ -1,199 +1,70 @@
1
1
  /**
2
2
  * Compile-time type assertion utility for TypeScript type testing.
3
3
  *
4
- * This function performs static type relationship checking at compile-time and has no runtime effect.
5
- * It is primarily used in test files to verify that TypeScript's type inference and type relationships
6
- * work as expected. The function will cause TypeScript compilation errors if the specified type
4
+ * This function performs static type relationship checking at compile-time and
5
+ * has no runtime effect. It is primarily used in test files to verify that
6
+ * TypeScript's type inference and type relationships work as expected. The
7
+ * function will cause TypeScript compilation errors if the specified type
7
8
  * relationship does not hold.
8
9
  *
9
10
  * ## Supported Type Relations
10
11
  *
11
12
  * ### Equality Relations
12
- * - **`"="` (strict equality)**: Asserts that types `A` and `B` are exactly the same type.
13
- * Uses TypeScript's internal type equality checking.
14
- * - **`"!="` (strict inequality)**: Asserts that types `A` and `B` are not exactly the same type.
13
+ *
14
+ * - **`"="` (strict equality)**: Asserts that types `A` and `B` are exactly the
15
+ * same type. Uses TypeScript's internal type equality checking.
16
+ * - **`"!="` (strict inequality)**: Asserts that types `A` and `B` are not
17
+ * exactly the same type.
15
18
  *
16
19
  * ### Assignability Relations
17
- * - **`"~="` (mutual assignability)**: Asserts that `A` extends `B` AND `B` extends `A`.
18
- * Types are structurally equivalent and mutually assignable.
19
- * - **`"<="` (subtype relation)**: Asserts that type `A` extends (is assignable to) type `B`.
20
- * Type `A` is a subtype of `B`.
21
- * - **`">="` (supertype relation)**: Asserts that type `B` extends (is assignable to) type `A`.
22
- * Type `A` is a supertype of `B`.
20
+ *
21
+ * - **`"~="` (mutual assignability)**: Asserts that `A` extends `B` AND `B`
22
+ * extends `A`. Types are structurally equivalent and mutually assignable.
23
+ * - **`"<="` (subtype relation)**: Asserts that type `A` extends (is assignable
24
+ * to) type `B`. Type `A` is a subtype of `B`.
25
+ * - **`">="` (supertype relation)**: Asserts that type `B` extends (is assignable
26
+ * to) type `A`. Type `A` is a supertype of `B`.
23
27
  *
24
28
  * ### Negative Assignability Relations
29
+ *
25
30
  * - **`"!<="` (not subtype)**: Asserts that type `A` does NOT extend type `B`.
26
31
  * - **`"!>="` (not supertype)**: Asserts that type `B` does NOT extend type `A`.
27
32
  *
28
33
  * ## Type Parameter Constraints
29
34
  *
30
- * @template A - The first type for comparison. Can be any TypeScript type including:
35
+ * @since 1.0.0
36
+ * @template A - The first type for comparison. Can be any TypeScript type
37
+ * including:
38
+ *
31
39
  * - Primitive types (string, number, boolean, etc.)
32
40
  * - Object types and interfaces
33
41
  * - Union and intersection types
34
42
  * - Generic types and type parameters
35
43
  * - Literal types and branded types
36
44
  * - Function types and return types
37
- * @template B - The second type for comparison. Same constraints as type `A`.
38
- *
39
- * @param _relation - A string literal representing the expected type relationship.
40
- * TypeScript's type system automatically infers and restricts the available operators
41
- * based on the actual relationship between types `A` and `B`. If an invalid relationship
42
- * is specified, TypeScript will show a compilation error.
43
- *
44
- * ## Usage Patterns
45
- *
46
- * ### Basic Type Testing
47
- * @example
48
- * ```typescript
49
- * import { expectType } from './expect-type.mjs';
50
- *
51
- * // Primitive type equality
52
- * expectType<string, string>("="); // ✓ exact match
53
- * expectType<number, string>("!="); // ✓ different types
54
- * expectType<42, number>("<="); // ✓ literal extends primitive
55
- * expectType<number, 42>(">="); // ✓ primitive is supertype
56
- *
57
- * // Type assertions will cause compilation errors for wrong relationships:
58
- * // expectType<string, number>("="); // ❌ TypeScript error
59
- * // expectType<number, string>("<="); // ❌ TypeScript error
60
- * ```
61
- *
62
- * ### Array and Tuple Type Validation
63
- * @example
64
- * ```typescript
65
- * // Testing array utility function return types
66
- * const zeros = Arr.zeros(3);
67
- * expectType<typeof zeros, readonly [0, 0, 0]>("=");
68
- *
69
- * const sequence = Arr.seq(5);
70
- * expectType<typeof sequence, readonly [0, 1, 2, 3, 4]>("=");
71
- *
72
- * // Dynamic length arrays
73
- * const dynamicArray = Arr.zeros(someLength);
74
- * expectType<typeof dynamicArray, readonly 0[]>("=");
75
- * ```
76
- *
77
- * ### Function Return Type Testing
78
- * @example
79
- * ```typescript
80
- * // Testing function return types
81
- * const createUser = () => ({ id: 1, name: 'John' });
82
- * expectType<ReturnType<typeof createUser>, { id: number; name: string }>("~=");
83
- *
84
- * // Generic function type inference
85
- * const identity = <T>(x: T): T => x;
86
- * const result = identity('hello');
87
- * expectType<typeof result, string>("=");
88
- * ```
89
- *
90
- * ### Union and Intersection Types
91
- * @example
92
- * ```typescript
93
- * // Union type relationships
94
- * expectType<string, string | number>("<="); // string extends union
95
- * expectType<string | number, string>(">="); // union contains string
96
- * expectType<string | number, number>(">="); // union contains number
97
- *
98
- * // Intersection type relationships
99
- * type A = { a: number };
100
- * type B = { b: string };
101
- * expectType<A & B, A>(">="); // intersection extends component
102
- * expectType<A, A & B>("<="); // component extends intersection
103
- * ```
104
45
  *
105
- * ### Branded Type Validation
106
- * @example
107
- * ```typescript
108
- * // Testing branded number types
109
- * expectType<PositiveInt, number>("<="); // branded type extends base
110
- * expectType<number, PositiveInt>(">="); // base type is supertype
111
- * expectType<PositiveInt, NegativeInt>("!="); // different branded types
112
- *
113
- * // Type guard function validation
114
- * if (isPositiveInt(value)) {
115
- * expectType<typeof value, PositiveInt>("<=");
116
- * }
117
- * ```
118
- *
119
- * ### Optional and Result Type Testing
120
- * @example
121
- * ```typescript
122
- * // Optional type narrowing
123
- * const optional: Optional<number> = Optional.some(42);
124
- * if (Optional.isSome(optional)) {
125
- * expectType<typeof optional, Optional.Some<number>>("<=");
126
- * }
127
- * if (Optional.isNone(optional)) {
128
- * expectType<typeof optional, Optional.None>("<=");
129
- * }
130
- *
131
- * // Result type validation
132
- * const result: Result<string, Error> = Result.ok('success');
133
- * expectType<typeof result, Result<string, Error>>("<=");
134
- * ```
135
- *
136
- * ### Type Guard and Validation Testing
137
- * @example
138
- * ```typescript
139
- * // Testing type guard functions
140
- * if (isRecord(value)) {
141
- * expectType<typeof value, UnknownRecord>("<=");
142
- * }
143
- *
144
- * // Testing compile-time type predicates
145
- * const obj = { key: 'value' };
146
- * if (hasKey(obj, 'key')) {
147
- * expectType<typeof obj.key, unknown>("<=");
148
- * }
149
- * ```
150
- *
151
- * ## Common Testing Patterns
152
- *
153
- * ### Dual Testing Strategy
154
- * Combine `expectType` with runtime assertions for comprehensive testing:
155
- *
156
- * @example
157
- * ```typescript
158
- * describe('Arr.zeros', () => {
159
- * test('should create array of zeros with correct type', () => {
160
- * const result = Arr.zeros(3);
161
- *
162
- * // Compile-time type assertion
163
- * expectType<typeof result, readonly [0, 0, 0]>("=");
164
- *
165
- * // Runtime behavior assertion
166
- * expect(result).toStrictEqual([0, 0, 0]);
167
- * });
168
- * });
169
- * ```
170
- *
171
- * ### Type Relationship Validation
172
- * Test complex type hierarchies and relationships:
173
- *
174
- * @example
175
- * ```typescript
176
- * // Ensure proper type hierarchy
177
- * expectType<PositiveInt, Int>("<="); // positive is subset of int
178
- * expectType<Int, FiniteNumber>("<="); // int is subset of finite
179
- * expectType<FiniteNumber, number>("<="); // finite is subset of number
180
- *
181
- * // Verify mutual exclusion
182
- * expectType<PositiveInt, NegativeInt>("!="); // different int types
183
- * expectType<PositiveInt, NegativeInt>("!<="); // neither extends the other
184
- * expectType<NegativeInt, PositiveInt>("!<=");
185
- * ```
186
- *
187
- * ## Important Notes
188
- *
189
- * - **Compile-time only**: This function has no runtime behavior and will be optimized away.
190
- * - **Type inference**: The available relation operators are automatically inferred by TypeScript
191
- * based on the actual type relationship between `A` and `B`.
192
- * - **Error feedback**: Invalid type relationships will cause clear TypeScript compilation errors.
193
- * - **Test organization**: Typically used in `.test.mts` files alongside runtime assertions.
194
- * - **Performance**: Has zero runtime overhead as it's purely a compile-time construct.
195
- *
196
- * @since 1.0.0
46
+ * @template B - The second type for comparison. Same constraints as type `A`.
47
+ * @param _relation - A string literal representing the expected type
48
+ * relationship. TypeScript's type system automatically infers and restricts
49
+ * the available operators based on the actual relationship between types `A`
50
+ * and `B`. If an invalid relationship is specified, TypeScript will show a
51
+ * compilation error.
52
+ *
53
+ * Combine `expectType` with runtime assertions for comprehensive testing:
54
+ *
55
+ * ## Important Notes
56
+ *
57
+ * - **Compile-time only**: This function has no runtime behavior and will be
58
+ * optimized away.
59
+ * - **Type inference**: The available relation operators are automatically
60
+ * inferred by TypeScript based on the actual type relationship between
61
+ * `A` and `B`.
62
+ * - **Error feedback**: Invalid type relationships will cause clear TypeScript
63
+ * compilation errors.
64
+ * - **Test organization**: Typically used in `.test.mts` files alongside runtime
65
+ * assertions.
66
+ * - **Performance**: Has zero runtime overhead as it's purely a compile-time
67
+ * construct.
197
68
  */
198
69
  const expectType = (_relation) => undefined;
199
70
 
@@ -1 +1 @@
1
- {"version":3,"file":"expect-type.mjs","sources":["../src/expect-type.mts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoMG;AACI,MAAM,UAAU,GAAG,CACxB,SAMoE,KAC3D;;;;"}
1
+ {"version":3,"file":"expect-type.mjs","sources":["../src/expect-type.mts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmEG;AACI,MAAM,UAAU,GAAG,CACxB,SAMoE,KAC3D;;;;"}
@@ -1,183 +1,78 @@
1
- /**
2
- * @internal
3
- * Utility type to extract the union of all values from a record type.
4
- * @template T The record type to extract values from.
5
- */
6
- type ValueOf<T> = T[keyof T];
7
- /**
8
- * @internal
9
- * Represents a record with unknown value types.
10
- */
11
- type UnknownRecord = Record<PropertyKey, unknown>;
12
- /**
13
- * @internal
14
- * Represents a readonly record mapping keys of type K to values of type V.
15
- * @template K The type of keys.
16
- * @template V The type of values.
17
- */
18
- type ReadonlyRecord<K extends PropertyKey, V> = Readonly<Record<K, V>>;
19
- /**
20
- * @internal
21
- * A relaxed version of Exclude that handles edge cases with property keys.
22
- * @template T The type to exclude from.
23
- * @template U The type to exclude.
24
- */
25
- type RelaxedExclude<T, U> = T extends U ? never : T;
26
- /**
27
- * @internal
28
- * Checks if two types are exactly equal.
29
- * @template T First type to compare.
30
- * @template U Second type to compare.
31
- */
32
- type TypeEq<T, U> = [T] extends [U] ? ([U] extends [T] ? true : false) : false;
33
1
  /**
34
2
  * Type-safe pattern matching function for string-based discriminated unions.
35
3
  *
36
- * Provides compile-time guarantees for exhaustive case handling when working with
37
- * literal string unions. Automatically enforces completeness checking when all
38
- * cases are covered, and requires a default value when cases are incomplete.
4
+ * Provides compile-time guarantees for exhaustive case handling when working
5
+ * with literal string unions. Automatically enforces completeness checking when
6
+ * all cases are covered, and requires a default value when cases are
7
+ * incomplete.
39
8
  *
40
9
  * ## Key Features:
41
- * - **Exhaustive Matching**: When all cases of a literal union are handled, no default value is needed
42
- * - **Partial Matching**: When cases are incomplete or working with general string types, a default value is required
10
+ *
11
+ * - **Exhaustive Matching**: When all cases of a literal union are handled, no
12
+ * default value is needed
13
+ * - **Partial Matching**: When cases are incomplete or working with general
14
+ * string types, a default value is required
43
15
  * - **Type Safety**: Prevents extra cases and ensures only valid keys are used
44
16
  * - **Strict Property Checking**: Rejects objects with unexpected properties
45
17
  *
46
- * @param target - The value to match against
47
- * @param cases - Object mapping possible values to their corresponding results
48
- * @param defaultValue - Fallback value (required when not all cases are covered)
49
- * @returns The matched result or default value
50
- *
51
- * @example
52
- * Exhaustive matching (no default needed):
53
- * ```typescript
54
- * type Status = 'loading' | 'success' | 'error';
55
- * const status: Status = 'loading';
56
- *
57
- * const message = match(status, {
58
- * loading: 'Please wait...',
59
- * success: 'Operation completed!',
60
- * error: 'Something went wrong'
61
- * });
62
- * // Type: string
63
- * // Result: 'Please wait...'
64
- * ```
65
- *
66
- * @example
67
- * Partial matching (default required):
68
- * ```typescript
69
- * type Priority = 'low' | 'medium' | 'high' | 'critical';
70
- * const priority: Priority = 'medium';
71
- *
72
- * const color = match(priority, {
73
- * high: 'red',
74
- * critical: 'darkred'
75
- * }, 'gray'); // Default required for uncovered cases
76
- * // Type: 'red' | 'darkred' | 'gray'
77
- * // Result: 'gray'
78
- * ```
79
- *
80
18
  * @example
81
- * Working with general string types:
82
- * ```typescript
83
- * const userInput: string = getUserInput();
84
19
  *
85
- * const route = match(userInput, {
86
- * 'home': '/',
87
- * 'about': '/about',
88
- * 'contact': '/contact'
89
- * }, '/404'); // Default required for string type
90
- * // Type: '/' | '/about' | '/contact' | '/404'
91
- * ```
20
+ * ```ts
21
+ * type Status = 'draft' | 'review' | 'published';
92
22
  *
93
- * @example
94
- * HTTP status code handling:
95
- * ```typescript
96
- * type HttpStatus = 200 | 404 | 500;
97
- * const status: HttpStatus = 404;
23
+ * const status: Status = 'draft';
98
24
  *
99
- * const response = match(String(status), {
100
- * '200': { ok: true, message: 'Success' },
101
- * '404': { ok: false, message: 'Not Found' },
102
- * '500': { ok: false, message: 'Server Error' }
25
+ * const message = match<
26
+ * Status,
27
+ * { draft: string; review: string; published: string }
28
+ * >(status, {
29
+ * draft: 'Work in progress',
30
+ * review: 'Awaiting feedback',
31
+ * published: 'Complete',
103
32
  * });
104
- * // All cases covered, no default needed
105
- * // Result: { ok: false, message: 'Not Found' }
106
- * ```
107
- *
108
- * @example
109
- * Complex discriminated union handling:
110
- * ```typescript
111
- * type ApiResponse =
112
- * | { status: 'loading' }
113
- * | { status: 'success'; data: string }
114
- * | { status: 'error'; error: string };
115
33
  *
116
- * const handleResponse = (response: ApiResponse) =>
117
- * match(response.status, {
118
- * loading: 'Please wait...',
119
- * success: 'Data loaded successfully!',
120
- * error: 'Failed to load data'
121
- * });
34
+ * assert(message === 'Work in progress');
122
35
  * ```
123
36
  *
124
- * @example
125
- * Advanced usage with functional composition:
126
- * ```typescript
127
- * // Creating reusable matchers
128
- * const logLevelToColor = (level: string) => match(level, {
129
- * 'debug': 'gray',
130
- * 'info': 'blue',
131
- * 'warn': 'yellow',
132
- * 'error': 'red'
133
- * }, 'black'); // Default for unknown levels
134
- *
135
- * const logLevelToIcon = (level: string) => match(level, {
136
- * 'debug': '🐛',
137
- * 'info': 'â„šī¸',
138
- * 'warn': 'âš ī¸',
139
- * 'error': '❌'
140
- * }, '📝');
141
- *
142
- * // Combining matchers
143
- * const formatLogEntry = (level: string, message: string) => ({
144
- * color: logLevelToColor(level),
145
- * icon: logLevelToIcon(level),
146
- * text: `${logLevelToIcon(level)} ${message}`
147
- * });
148
- * ```
37
+ * @param target - The value to match against
38
+ * @param cases - Object mapping possible values to their corresponding results
39
+ * @param defaultValue - Fallback value (required when not all cases are
40
+ * covered)
41
+ * @returns The matched result or default value
149
42
  */
150
43
  export declare function match<const Case extends string, const R extends ReadonlyRecord<Case, unknown>>(target: Case, cases: StrictPropertyCheck<R, Case>): R[Case];
151
44
  export declare function match<const Case extends string, const R extends UnknownRecord, const D>(target: Case, cases: StrictPropertyCheck<R, Case>, defaultValue: IsLiteralUnionFullyCovered<Case, R> extends true ? never : D): ValueOf<R> | D;
152
45
  /**
46
+ * @template T The object type to check.
47
+ * @template ExpectedKeys The union of string literal types representing the
48
+ * allowed keys.
153
49
  * @internal
154
50
  * Helper type to ensure that an object `T` only contains keys specified in `ExpectedKeys`.
155
51
  * If `T` has any keys not in `ExpectedKeys`, this type resolves to `never`.
156
- * @template T The object type to check.
157
- * @template ExpectedKeys The union of string literal types representing the allowed keys.
158
52
  */
159
53
  type StrictPropertyCheck<T, ExpectedKeys extends PropertyKey> = RelaxedExclude<keyof T, ExpectedKeys> extends never ? T : never;
160
54
  /**
55
+ * @template Case A union of string literal types representing the possible
56
+ * cases.
57
+ * @template R A record type.
161
58
  * @internal
162
59
  * Helper type to check if all cases in `Case` union are fully covered by keys in `R`.
163
60
  * This checks bidirectional coverage: all Case members are in R, and no extra keys.
164
- * @template Case A union of string literal types representing the possible cases.
165
- * @template R A record type.
166
61
  */
167
62
  type AllCasesCovered<Case extends PropertyKey, R> = TypeEq<Case, keyof R> extends true ? true : false;
168
63
  /**
169
- * @internal
170
- * Helper type to check if Case is a literal union type and all cases are covered.
171
64
  * @template Case A union of string literal types.
172
65
  * @template R A record type.
66
+ * @internal
67
+ * Helper type to check if Case is a literal union type and all cases are covered.
173
68
  */
174
69
  type IsLiteralUnionFullyCovered<Case extends PropertyKey, R extends UnknownRecord> = TypeEq<IsLiteralType<Case>, true> extends true ? AllCasesCovered<Case, R> : false;
175
70
  /**
71
+ * @template T The PropertyKey type to check.
72
+ * @returns `true` if `T` is a literal type, `false` otherwise.
176
73
  * @internal
177
74
  * Helper type to determine if a given PropertyKey `T` is a literal type (e.g., 'a', 1)
178
75
  * or a general type (e.g., string, number).
179
- * @template T The PropertyKey type to check.
180
- * @returns `true` if `T` is a literal type, `false` otherwise.
181
76
  */
182
77
  type IsLiteralType<T extends PropertyKey> = string extends T ? false : number extends T ? false : symbol extends T ? false : true;
183
78
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"match.d.mts","sourceRoot":"","sources":["../../src/functional/match.mts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAE7B;;;GAGG;AACH,KAAK,aAAa,GAAG,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AAElD;;;;;GAKG;AACH,KAAK,cAAc,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAEvE;;;;;GAKG;AACH,KAAK,cAAc,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;AAEpD;;;;;GAKG;AACH,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoHG;AACH,wBAAgB,KAAK,CACnB,KAAK,CAAC,IAAI,SAAS,MAAM,EACzB,KAAK,CAAC,CAAC,SAAS,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,EAC7C,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;AAE9D,wBAAgB,KAAK,CACnB,KAAK,CAAC,IAAI,SAAS,MAAM,EACzB,KAAK,CAAC,CAAC,SAAS,aAAa,EAC7B,KAAK,CAAC,CAAC,EAEP,MAAM,EAAE,IAAI,EACZ,KAAK,EAAE,mBAAmB,CAAC,CAAC,EAAE,IAAI,CAAC,EACnC,YAAY,EAAE,0BAA0B,CAAC,IAAI,EAAE,CAAC,CAAC,SAAS,IAAI,GAAG,KAAK,GAAG,CAAC,GACzE,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAuBlB;;;;;;GAMG;AACH,KAAK,mBAAmB,CAAC,CAAC,EAAE,YAAY,SAAS,WAAW,IAC1D,cAAc,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC,SAAS,KAAK,GAAG,CAAC,GAAG,KAAK,CAAC;AAElE;;;;;;GAMG;AACH,KAAK,eAAe,CAAC,IAAI,SAAS,WAAW,EAAE,CAAC,IAC9C,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,SAAS,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;AAOpD;;;;;GAKG;AACH,KAAK,0BAA0B,CAC7B,IAAI,SAAS,WAAW,EACxB,CAAC,SAAS,aAAa,IAEvB,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,SAAS,IAAI,GAC1C,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC,GACxB,KAAK,CAAC;AAkBZ;;;;;;GAMG;AACH,KAAK,aAAa,CAAC,CAAC,SAAS,WAAW,IAAI,MAAM,SAAS,CAAC,GACxD,KAAK,GACL,MAAM,SAAS,CAAC,GACd,KAAK,GACL,MAAM,SAAS,CAAC,GACd,KAAK,GACL,IAAI,CAAC"}
1
+ {"version":3,"file":"match.d.mts","sourceRoot":"","sources":["../../src/functional/match.mts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,KAAK,CACnB,KAAK,CAAC,IAAI,SAAS,MAAM,EACzB,KAAK,CAAC,CAAC,SAAS,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,EAC7C,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;AAE9D,wBAAgB,KAAK,CACnB,KAAK,CAAC,IAAI,SAAS,MAAM,EACzB,KAAK,CAAC,CAAC,SAAS,aAAa,EAC7B,KAAK,CAAC,CAAC,EAEP,MAAM,EAAE,IAAI,EACZ,KAAK,EAAE,mBAAmB,CAAC,CAAC,EAAE,IAAI,CAAC,EACnC,YAAY,EAAE,0BAA0B,CAAC,IAAI,EAAE,CAAC,CAAC,SAAS,IAAI,GAAG,KAAK,GAAG,CAAC,GACzE,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAuBlB;;;;;;;GAOG;AACH,KAAK,mBAAmB,CAAC,CAAC,EAAE,YAAY,SAAS,WAAW,IAC1D,cAAc,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC,SAAS,KAAK,GAAG,CAAC,GAAG,KAAK,CAAC;AAElE;;;;;;;GAOG;AACH,KAAK,eAAe,CAAC,IAAI,SAAS,WAAW,EAAE,CAAC,IAC9C,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,SAAS,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;AAOpD;;;;;GAKG;AACH,KAAK,0BAA0B,CAC7B,IAAI,SAAS,WAAW,EACxB,CAAC,SAAS,aAAa,IAEvB,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,SAAS,IAAI,GAC1C,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC,GACxB,KAAK,CAAC;AAkBZ;;;;;;GAMG;AACH,KAAK,aAAa,CAAC,CAAC,SAAS,WAAW,IAAI,MAAM,SAAS,CAAC,GACxD,KAAK,GACL,MAAM,SAAS,CAAC,GACd,KAAK,GACL,MAAM,SAAS,CAAC,GACd,KAAK,GACL,IAAI,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"match.mjs","sources":["../../src/functional/match.mts"],"sourcesContent":[null],"names":[],"mappings":";;AA4KM,SAAU,KAAK,CAKnB,GAAG,IAEmD,EAAA;AAEtD,IAAA,QAAQ,IAAI,CAAC,MAAM;QACjB,KAAK,CAAC,EAAE;AACN,YAAA,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,IAAI;AAC5B,YAAA,OAAO,KAAK,CAAC,MAAM,CAAC;;QAEtB,KAAK,CAAC,EAAE;YACN,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,YAAY,CAAC,GAAG,IAAI;AAC1C,YAAA,OAAO,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,YAAY;;;AAGlE;;;;"}
1
+ {"version":3,"file":"match.mjs","sources":["../../src/functional/match.mts"],"sourcesContent":[null],"names":[],"mappings":";;AA4DM,SAAU,KAAK,CAKnB,GAAG,IAEmD,EAAA;AAEtD,IAAA,QAAQ,IAAI,CAAC,MAAM;QACjB,KAAK,CAAC,EAAE;AACN,YAAA,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,IAAI;AAC5B,YAAA,OAAO,KAAK,CAAC,MAAM,CAAC;;QAEtB,KAAK,CAAC,EAAE;YACN,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,YAAY,CAAC,GAAG,IAAI;AAC1C,YAAA,OAAO,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,YAAY;;;AAGlE;;;;"}