ts-data-forge 3.3.1 → 4.0.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 (401) hide show
  1. package/dist/array/impl/array-utils-element-access.d.mts +3 -4
  2. package/dist/array/impl/array-utils-element-access.d.mts.map +1 -1
  3. package/dist/array/impl/array-utils-element-access.mjs +8 -8
  4. package/dist/array/impl/array-utils-element-access.mjs.map +1 -1
  5. package/dist/array/impl/array-utils-reducing-value.d.mts +8 -9
  6. package/dist/array/impl/array-utils-reducing-value.d.mts.map +1 -1
  7. package/dist/array/impl/array-utils-reducing-value.mjs +9 -7
  8. package/dist/array/impl/array-utils-reducing-value.mjs.map +1 -1
  9. package/dist/array/impl/array-utils-search.d.mts +0 -1
  10. package/dist/array/impl/array-utils-search.d.mts.map +1 -1
  11. package/dist/array/impl/array-utils-search.mjs +6 -6
  12. package/dist/array/impl/array-utils-search.mjs.map +1 -1
  13. package/dist/array/impl/array-utils-transformation.mjs +2 -4
  14. package/dist/array/impl/array-utils-transformation.mjs.map +1 -1
  15. package/dist/collections/imap-mapped.d.mts +0 -1
  16. package/dist/collections/imap-mapped.d.mts.map +1 -1
  17. package/dist/collections/imap-mapped.mjs +7 -6
  18. package/dist/collections/imap-mapped.mjs.map +1 -1
  19. package/dist/collections/imap.d.mts +0 -1
  20. package/dist/collections/imap.d.mts.map +1 -1
  21. package/dist/collections/imap.mjs +11 -9
  22. package/dist/collections/imap.mjs.map +1 -1
  23. package/dist/collections/queue.d.mts +0 -1
  24. package/dist/collections/queue.d.mts.map +1 -1
  25. package/dist/collections/queue.mjs +4 -4
  26. package/dist/collections/queue.mjs.map +1 -1
  27. package/dist/collections/stack.d.mts +0 -1
  28. package/dist/collections/stack.d.mts.map +1 -1
  29. package/dist/collections/stack.mjs +4 -4
  30. package/dist/collections/stack.mjs.map +1 -1
  31. package/dist/entry-point.d.mts +1 -0
  32. package/dist/entry-point.d.mts.map +1 -1
  33. package/dist/entry-point.mjs +6 -4
  34. package/dist/entry-point.mjs.map +1 -1
  35. package/dist/functional/index.d.mts +2 -2
  36. package/dist/functional/index.d.mts.map +1 -1
  37. package/dist/functional/index.mjs +4 -2
  38. package/dist/functional/index.mjs.map +1 -1
  39. package/dist/functional/optional/impl/index.d.mts +18 -0
  40. package/dist/functional/optional/impl/index.d.mts.map +1 -0
  41. package/dist/functional/optional/impl/index.mjs +17 -0
  42. package/dist/functional/optional/impl/index.mjs.map +1 -0
  43. package/dist/functional/optional/impl/optional-expect-to-be.d.mts +29 -0
  44. package/dist/functional/optional/impl/optional-expect-to-be.d.mts.map +1 -0
  45. package/dist/functional/optional/impl/optional-expect-to-be.mjs +25 -0
  46. package/dist/functional/optional/impl/optional-expect-to-be.mjs.map +1 -0
  47. package/dist/functional/optional/impl/optional-filter.d.mts +29 -0
  48. package/dist/functional/optional/impl/optional-filter.d.mts.map +1 -0
  49. package/dist/functional/optional/impl/optional-filter.mjs +28 -0
  50. package/dist/functional/optional/impl/optional-filter.mjs.map +1 -0
  51. package/dist/functional/optional/impl/optional-flat-map.d.mts +33 -0
  52. package/dist/functional/optional/impl/optional-flat-map.d.mts.map +1 -0
  53. package/dist/functional/optional/impl/optional-flat-map.mjs +21 -0
  54. package/dist/functional/optional/impl/optional-flat-map.mjs.map +1 -0
  55. package/dist/functional/optional/impl/optional-from-nullable.d.mts +24 -0
  56. package/dist/functional/optional/impl/optional-from-nullable.d.mts.map +1 -0
  57. package/dist/functional/optional/impl/optional-from-nullable.mjs +29 -0
  58. package/dist/functional/optional/impl/optional-from-nullable.mjs.map +1 -0
  59. package/dist/functional/optional/impl/optional-is-none.d.mts +22 -0
  60. package/dist/functional/optional/impl/optional-is-none.d.mts.map +1 -0
  61. package/dist/functional/optional/impl/optional-is-none.mjs +25 -0
  62. package/dist/functional/optional/impl/optional-is-none.mjs.map +1 -0
  63. package/dist/functional/optional/impl/optional-is-optional.d.mts +18 -0
  64. package/dist/functional/optional/impl/optional-is-optional.d.mts.map +1 -0
  65. package/dist/functional/optional/impl/optional-is-optional.mjs +27 -0
  66. package/dist/functional/optional/impl/optional-is-optional.mjs.map +1 -0
  67. package/dist/functional/optional/impl/optional-is-some.d.mts +22 -0
  68. package/dist/functional/optional/impl/optional-is-some.d.mts.map +1 -0
  69. package/dist/functional/optional/impl/optional-is-some.mjs +25 -0
  70. package/dist/functional/optional/impl/optional-is-some.mjs.map +1 -0
  71. package/dist/functional/optional/impl/optional-map.d.mts +31 -0
  72. package/dist/functional/optional/impl/optional-map.d.mts.map +1 -0
  73. package/dist/functional/optional/impl/optional-map.mjs +25 -0
  74. package/dist/functional/optional/impl/optional-map.mjs.map +1 -0
  75. package/dist/functional/optional/impl/optional-none.d.mts +16 -0
  76. package/dist/functional/optional/impl/optional-none.d.mts.map +1 -0
  77. package/dist/functional/optional/impl/optional-none.mjs +20 -0
  78. package/dist/functional/optional/impl/optional-none.mjs.map +1 -0
  79. package/dist/functional/optional/impl/optional-or-else.d.mts +35 -0
  80. package/dist/functional/optional/impl/optional-or-else.d.mts.map +1 -0
  81. package/dist/functional/optional/impl/optional-or-else.mjs +19 -0
  82. package/dist/functional/optional/impl/optional-or-else.mjs.map +1 -0
  83. package/dist/functional/optional/impl/optional-some.d.mts +19 -0
  84. package/dist/functional/optional/impl/optional-some.d.mts.map +1 -0
  85. package/dist/functional/optional/impl/optional-some.mjs +26 -0
  86. package/dist/functional/optional/impl/optional-some.mjs.map +1 -0
  87. package/dist/functional/optional/impl/optional-to-nullable.d.mts +27 -0
  88. package/dist/functional/optional/impl/optional-to-nullable.d.mts.map +1 -0
  89. package/dist/functional/optional/impl/optional-to-nullable.mjs +31 -0
  90. package/dist/functional/optional/impl/optional-to-nullable.mjs.map +1 -0
  91. package/dist/functional/optional/impl/optional-unwrap-or.d.mts +33 -0
  92. package/dist/functional/optional/impl/optional-unwrap-or.d.mts.map +1 -0
  93. package/dist/functional/optional/impl/optional-unwrap-or.mjs +19 -0
  94. package/dist/functional/optional/impl/optional-unwrap-or.mjs.map +1 -0
  95. package/dist/functional/optional/impl/optional-unwrap-throw.d.mts +29 -0
  96. package/dist/functional/optional/impl/optional-unwrap-throw.d.mts.map +1 -0
  97. package/dist/functional/optional/impl/optional-unwrap-throw.mjs +38 -0
  98. package/dist/functional/optional/impl/optional-unwrap-throw.mjs.map +1 -0
  99. package/dist/functional/optional/impl/optional-unwrap.d.mts +28 -0
  100. package/dist/functional/optional/impl/optional-unwrap.d.mts.map +1 -0
  101. package/dist/functional/optional/impl/optional-unwrap.mjs +11 -0
  102. package/dist/functional/optional/impl/optional-unwrap.mjs.map +1 -0
  103. package/dist/functional/optional/impl/optional-zip.d.mts +31 -0
  104. package/dist/functional/optional/impl/optional-zip.d.mts.map +1 -0
  105. package/dist/functional/optional/impl/optional-zip.mjs +39 -0
  106. package/dist/functional/optional/impl/optional-zip.mjs.map +1 -0
  107. package/dist/functional/optional/impl/tag.d.mts +5 -0
  108. package/dist/functional/optional/impl/tag.d.mts.map +1 -0
  109. package/dist/functional/optional/impl/tag.mjs +7 -0
  110. package/dist/functional/optional/impl/tag.mjs.map +1 -0
  111. package/dist/functional/optional/impl/types.d.mts +22 -0
  112. package/dist/functional/optional/impl/types.d.mts.map +1 -0
  113. package/dist/functional/optional/impl/types.mjs +2 -0
  114. package/dist/functional/optional/impl/types.mjs.map +1 -0
  115. package/dist/functional/optional/index.d.mts +2 -0
  116. package/dist/functional/optional/index.d.mts.map +1 -0
  117. package/dist/functional/optional/index.mjs +3 -0
  118. package/dist/functional/optional/index.mjs.map +1 -0
  119. package/dist/functional/pipe.d.mts +4 -4
  120. package/dist/functional/pipe.d.mts.map +1 -1
  121. package/dist/functional/pipe.mjs +4 -3
  122. package/dist/functional/pipe.mjs.map +1 -1
  123. package/dist/functional/result/impl/index.d.mts +24 -0
  124. package/dist/functional/result/impl/index.d.mts.map +1 -0
  125. package/dist/functional/result/impl/index.mjs +23 -0
  126. package/dist/functional/result/impl/index.mjs.map +1 -0
  127. package/dist/functional/result/impl/result-err.d.mts +25 -0
  128. package/dist/functional/result/impl/result-err.d.mts.map +1 -0
  129. package/dist/functional/result/impl/result-err.mjs +32 -0
  130. package/dist/functional/result/impl/result-err.mjs.map +1 -0
  131. package/dist/functional/result/impl/result-expect-to-be.d.mts +27 -0
  132. package/dist/functional/result/impl/result-expect-to-be.d.mts.map +1 -0
  133. package/dist/functional/result/impl/result-expect-to-be.mjs +26 -0
  134. package/dist/functional/result/impl/result-expect-to-be.mjs.map +1 -0
  135. package/dist/functional/result/impl/result-flat-map.d.mts +39 -0
  136. package/dist/functional/result/impl/result-flat-map.d.mts.map +1 -0
  137. package/dist/functional/result/impl/result-flat-map.mjs +24 -0
  138. package/dist/functional/result/impl/result-flat-map.mjs.map +1 -0
  139. package/dist/functional/result/impl/result-fold.d.mts +45 -0
  140. package/dist/functional/result/impl/result-fold.d.mts.map +1 -0
  141. package/dist/functional/result/impl/result-fold.mjs +26 -0
  142. package/dist/functional/result/impl/result-fold.mjs.map +1 -0
  143. package/dist/functional/result/impl/result-from-promise.d.mts +32 -0
  144. package/dist/functional/result/impl/result-from-promise.d.mts.map +1 -0
  145. package/dist/functional/result/impl/result-from-promise.mjs +32 -0
  146. package/dist/functional/result/impl/result-from-promise.mjs.map +1 -0
  147. package/dist/functional/result/impl/result-from-throwable.d.mts +29 -0
  148. package/dist/functional/result/impl/result-from-throwable.d.mts.map +1 -0
  149. package/dist/functional/result/impl/result-from-throwable.mjs +46 -0
  150. package/dist/functional/result/impl/result-from-throwable.mjs.map +1 -0
  151. package/dist/functional/result/impl/result-is-err.d.mts +20 -0
  152. package/dist/functional/result/impl/result-is-err.d.mts.map +1 -0
  153. package/dist/functional/result/impl/result-is-err.mjs +23 -0
  154. package/dist/functional/result/impl/result-is-err.mjs.map +1 -0
  155. package/dist/functional/result/impl/result-is-ok.d.mts +20 -0
  156. package/dist/functional/result/impl/result-is-ok.d.mts.map +1 -0
  157. package/dist/functional/result/impl/result-is-ok.mjs +23 -0
  158. package/dist/functional/result/impl/result-is-ok.mjs.map +1 -0
  159. package/dist/functional/result/impl/result-is-result.d.mts +17 -0
  160. package/dist/functional/result/impl/result-is-result.d.mts.map +1 -0
  161. package/dist/functional/result/impl/result-is-result.mjs +26 -0
  162. package/dist/functional/result/impl/result-is-result.mjs.map +1 -0
  163. package/dist/functional/result/impl/result-map-err.d.mts +33 -0
  164. package/dist/functional/result/impl/result-map-err.d.mts.map +1 -0
  165. package/dist/functional/result/impl/result-map-err.mjs +25 -0
  166. package/dist/functional/result/impl/result-map-err.mjs.map +1 -0
  167. package/dist/functional/result/impl/result-map.d.mts +34 -0
  168. package/dist/functional/result/impl/result-map.d.mts.map +1 -0
  169. package/dist/functional/result/impl/result-map.mjs +25 -0
  170. package/dist/functional/result/impl/result-map.mjs.map +1 -0
  171. package/dist/functional/result/impl/result-ok.d.mts +25 -0
  172. package/dist/functional/result/impl/result-ok.d.mts.map +1 -0
  173. package/dist/functional/result/impl/result-ok.mjs +32 -0
  174. package/dist/functional/result/impl/result-ok.mjs.map +1 -0
  175. package/dist/functional/result/impl/result-or-else.d.mts +32 -0
  176. package/dist/functional/result/impl/result-or-else.d.mts.map +1 -0
  177. package/dist/functional/result/impl/result-or-else.mjs +20 -0
  178. package/dist/functional/result/impl/result-or-else.mjs.map +1 -0
  179. package/dist/functional/result/impl/result-swap.d.mts +20 -0
  180. package/dist/functional/result/impl/result-swap.d.mts.map +1 -0
  181. package/dist/functional/result/impl/result-swap.mjs +28 -0
  182. package/dist/functional/result/impl/result-swap.mjs.map +1 -0
  183. package/dist/functional/result/impl/result-to-optional.d.mts +28 -0
  184. package/dist/functional/result/impl/result-to-optional.d.mts.map +1 -0
  185. package/dist/functional/result/impl/result-to-optional.mjs +34 -0
  186. package/dist/functional/result/impl/result-to-optional.mjs.map +1 -0
  187. package/dist/functional/result/impl/result-unwrap-err-or.d.mts +29 -0
  188. package/dist/functional/result/impl/result-unwrap-err-or.d.mts.map +1 -0
  189. package/dist/functional/result/impl/result-unwrap-err-or.mjs +20 -0
  190. package/dist/functional/result/impl/result-unwrap-err-or.mjs.map +1 -0
  191. package/dist/functional/result/impl/result-unwrap-err-throw.d.mts +30 -0
  192. package/dist/functional/result/impl/result-unwrap-err-throw.d.mts.map +1 -0
  193. package/dist/functional/result/impl/result-unwrap-err-throw.mjs +47 -0
  194. package/dist/functional/result/impl/result-unwrap-err-throw.mjs.map +1 -0
  195. package/dist/functional/result/impl/result-unwrap-err.d.mts +31 -0
  196. package/dist/functional/result/impl/result-unwrap-err.d.mts.map +1 -0
  197. package/dist/functional/result/impl/result-unwrap-err.mjs +36 -0
  198. package/dist/functional/result/impl/result-unwrap-err.mjs.map +1 -0
  199. package/dist/functional/result/impl/result-unwrap-ok-or.d.mts +29 -0
  200. package/dist/functional/result/impl/result-unwrap-ok-or.d.mts.map +1 -0
  201. package/dist/functional/result/impl/result-unwrap-ok-or.mjs +20 -0
  202. package/dist/functional/result/impl/result-unwrap-ok-or.mjs.map +1 -0
  203. package/dist/functional/result/impl/result-unwrap-ok.d.mts +23 -0
  204. package/dist/functional/result/impl/result-unwrap-ok.d.mts.map +1 -0
  205. package/dist/functional/result/impl/result-unwrap-ok.mjs +11 -0
  206. package/dist/functional/result/impl/result-unwrap-ok.mjs.map +1 -0
  207. package/dist/functional/result/impl/result-unwrap-throw.d.mts +30 -0
  208. package/dist/functional/result/impl/result-unwrap-throw.d.mts.map +1 -0
  209. package/dist/functional/result/impl/result-unwrap-throw.mjs +41 -0
  210. package/dist/functional/result/impl/result-unwrap-throw.mjs.map +1 -0
  211. package/dist/functional/result/impl/result-zip.d.mts +29 -0
  212. package/dist/functional/result/impl/result-zip.d.mts.map +1 -0
  213. package/dist/functional/result/impl/result-zip.mjs +38 -0
  214. package/dist/functional/result/impl/result-zip.mjs.map +1 -0
  215. package/dist/functional/result/impl/tag.d.mts +5 -0
  216. package/dist/functional/result/impl/tag.d.mts.map +1 -0
  217. package/dist/functional/result/impl/tag.mjs +7 -0
  218. package/dist/functional/result/impl/tag.mjs.map +1 -0
  219. package/dist/functional/result/impl/types.d.mts +29 -0
  220. package/dist/functional/result/impl/types.d.mts.map +1 -0
  221. package/dist/functional/result/impl/types.mjs +2 -0
  222. package/dist/functional/result/impl/types.mjs.map +1 -0
  223. package/dist/functional/result/index.d.mts +2 -0
  224. package/dist/functional/result/index.d.mts.map +1 -0
  225. package/dist/functional/result/index.mjs +3 -0
  226. package/dist/functional/result/index.mjs.map +1 -0
  227. package/dist/globals.d.mts +83 -0
  228. package/dist/index.d.mts +0 -1
  229. package/dist/index.d.mts.map +1 -1
  230. package/dist/index.mjs +0 -4
  231. package/dist/index.mjs.map +1 -1
  232. package/dist/json/json.d.mts +0 -1
  233. package/dist/json/json.d.mts.map +1 -1
  234. package/dist/json/json.mjs +8 -8
  235. package/dist/json/json.mjs.map +1 -1
  236. package/dist/number/branded-types/finite-number.mjs +1 -1
  237. package/dist/number/branded-types/finite-number.mjs.map +1 -1
  238. package/dist/number/branded-types/int.mjs +1 -1
  239. package/dist/number/branded-types/int.mjs.map +1 -1
  240. package/dist/number/branded-types/int16.mjs +1 -1
  241. package/dist/number/branded-types/int16.mjs.map +1 -1
  242. package/dist/number/branded-types/int32.mjs +1 -1
  243. package/dist/number/branded-types/int32.mjs.map +1 -1
  244. package/dist/number/branded-types/non-negative-finite-number.mjs +1 -1
  245. package/dist/number/branded-types/non-negative-finite-number.mjs.map +1 -1
  246. package/dist/number/branded-types/non-negative-int16.mjs +1 -1
  247. package/dist/number/branded-types/non-negative-int16.mjs.map +1 -1
  248. package/dist/number/branded-types/non-negative-int32.mjs +1 -1
  249. package/dist/number/branded-types/non-negative-int32.mjs.map +1 -1
  250. package/dist/number/branded-types/non-zero-finite-number.mjs +1 -1
  251. package/dist/number/branded-types/non-zero-finite-number.mjs.map +1 -1
  252. package/dist/number/branded-types/non-zero-int.mjs +1 -1
  253. package/dist/number/branded-types/non-zero-int.mjs.map +1 -1
  254. package/dist/number/branded-types/non-zero-int16.mjs +1 -1
  255. package/dist/number/branded-types/non-zero-int16.mjs.map +1 -1
  256. package/dist/number/branded-types/non-zero-int32.mjs +1 -1
  257. package/dist/number/branded-types/non-zero-int32.mjs.map +1 -1
  258. package/dist/number/branded-types/non-zero-safe-int.mjs +1 -1
  259. package/dist/number/branded-types/non-zero-safe-int.mjs.map +1 -1
  260. package/dist/number/branded-types/non-zero-uint16.mjs +1 -1
  261. package/dist/number/branded-types/non-zero-uint16.mjs.map +1 -1
  262. package/dist/number/branded-types/non-zero-uint32.mjs +1 -1
  263. package/dist/number/branded-types/non-zero-uint32.mjs.map +1 -1
  264. package/dist/number/branded-types/positive-finite-number.mjs +1 -1
  265. package/dist/number/branded-types/positive-finite-number.mjs.map +1 -1
  266. package/dist/number/branded-types/positive-int.mjs +1 -1
  267. package/dist/number/branded-types/positive-int.mjs.map +1 -1
  268. package/dist/number/branded-types/positive-int16.mjs +1 -1
  269. package/dist/number/branded-types/positive-int16.mjs.map +1 -1
  270. package/dist/number/branded-types/positive-int32.mjs +1 -1
  271. package/dist/number/branded-types/positive-int32.mjs.map +1 -1
  272. package/dist/number/branded-types/positive-safe-int.mjs +1 -1
  273. package/dist/number/branded-types/positive-safe-int.mjs.map +1 -1
  274. package/dist/number/branded-types/positive-uint16.mjs +1 -1
  275. package/dist/number/branded-types/positive-uint16.mjs.map +1 -1
  276. package/dist/number/branded-types/positive-uint32.mjs +1 -1
  277. package/dist/number/branded-types/positive-uint32.mjs.map +1 -1
  278. package/dist/number/branded-types/safe-int.mjs +1 -1
  279. package/dist/number/branded-types/safe-int.mjs.map +1 -1
  280. package/dist/number/branded-types/safe-uint.mjs +1 -1
  281. package/dist/number/branded-types/safe-uint.mjs.map +1 -1
  282. package/dist/number/branded-types/uint.mjs +1 -1
  283. package/dist/number/branded-types/uint.mjs.map +1 -1
  284. package/dist/number/branded-types/uint16.mjs +1 -1
  285. package/dist/number/branded-types/uint16.mjs.map +1 -1
  286. package/dist/number/branded-types/uint32.mjs +1 -1
  287. package/dist/number/branded-types/uint32.mjs.map +1 -1
  288. package/dist/number/enum/int8.mjs +1 -1
  289. package/dist/number/enum/int8.mjs.map +1 -1
  290. package/dist/number/enum/uint8.mjs +1 -1
  291. package/dist/number/enum/uint8.mjs.map +1 -1
  292. package/dist/number/refined-number-utils.mjs +0 -2
  293. package/dist/number/refined-number-utils.mjs.map +1 -1
  294. package/dist/promise/promise.d.mts +0 -1
  295. package/dist/promise/promise.d.mts.map +1 -1
  296. package/dist/promise/promise.mjs +2 -3
  297. package/dist/promise/promise.mjs.map +1 -1
  298. package/package.json +27 -21
  299. package/src/array/impl/array-utils-element-access.mts +6 -6
  300. package/src/array/impl/array-utils-element-access.test.mts +6 -6
  301. package/src/array/impl/array-utils-reducing-value.mts +8 -24
  302. package/src/array/impl/array-utils-reducing-value.test.mts +8 -8
  303. package/src/array/impl/array-utils-slice-clamped.test.mts +1 -1
  304. package/src/entry-point.mts +1 -0
  305. package/src/functional/index.mts +2 -2
  306. package/src/functional/optional/impl/index.mts +17 -0
  307. package/src/functional/optional/impl/optional-expect-to-be.mts +65 -0
  308. package/src/functional/optional/impl/optional-filter.mts +71 -0
  309. package/src/functional/optional/impl/optional-flat-map.mts +67 -0
  310. package/src/functional/optional/impl/optional-from-nullable.mts +28 -0
  311. package/src/functional/optional/impl/optional-is-none.mts +25 -0
  312. package/src/functional/optional/impl/optional-is-optional.mts +27 -0
  313. package/src/functional/optional/impl/optional-is-some.mts +25 -0
  314. package/src/functional/optional/impl/optional-map.mts +69 -0
  315. package/src/functional/optional/impl/optional-none.mts +17 -0
  316. package/src/functional/optional/impl/optional-or-else.mts +73 -0
  317. package/src/functional/optional/impl/optional-some.mts +23 -0
  318. package/src/functional/optional/impl/optional-to-nullable.mts +31 -0
  319. package/src/functional/optional/impl/optional-unwrap-or.mts +64 -0
  320. package/src/functional/optional/impl/optional-unwrap-throw.mts +39 -0
  321. package/src/functional/optional/impl/optional-unwrap.mts +41 -0
  322. package/src/functional/optional/impl/optional-zip.mts +40 -0
  323. package/src/functional/optional/impl/tag.mts +6 -0
  324. package/src/functional/optional/impl/types.mts +28 -0
  325. package/src/functional/optional/index.mts +1 -0
  326. package/src/functional/optional.test.mts +7 -8
  327. package/src/functional/pipe.mts +5 -5
  328. package/src/functional/pipe.test.mts +1 -1
  329. package/src/functional/result/impl/index.mts +23 -0
  330. package/src/functional/result/impl/result-err.mts +29 -0
  331. package/src/functional/result/impl/result-expect-to-be.mts +63 -0
  332. package/src/functional/result/impl/result-flat-map.mts +79 -0
  333. package/src/functional/result/impl/result-fold.mts +95 -0
  334. package/src/functional/result/impl/result-from-promise.mts +39 -0
  335. package/src/functional/result/impl/result-from-throwable.mts +42 -0
  336. package/src/functional/result/impl/result-is-err.mts +23 -0
  337. package/src/functional/result/impl/result-is-ok.mts +23 -0
  338. package/src/functional/result/impl/result-is-result.mts +23 -0
  339. package/src/functional/result/impl/result-map-err.mts +72 -0
  340. package/src/functional/result/impl/result-map.mts +73 -0
  341. package/src/functional/result/impl/result-ok.mts +29 -0
  342. package/src/functional/result/impl/result-or-else.mts +63 -0
  343. package/src/functional/result/impl/result-swap.mts +28 -0
  344. package/src/functional/result/impl/result-to-optional.mts +34 -0
  345. package/src/functional/result/impl/result-unwrap-err-or.mts +60 -0
  346. package/src/functional/result/impl/result-unwrap-err-throw.mts +53 -0
  347. package/src/functional/result/impl/result-unwrap-err.mts +36 -0
  348. package/src/functional/result/impl/result-unwrap-ok-or.mts +60 -0
  349. package/src/functional/result/impl/result-unwrap-ok.mts +35 -0
  350. package/src/functional/result/impl/result-unwrap-throw.mts +43 -0
  351. package/src/functional/result/impl/result-zip.mts +39 -0
  352. package/src/functional/result/impl/tag.mts +6 -0
  353. package/src/functional/result/impl/types.mts +35 -0
  354. package/src/functional/result/index.mts +1 -0
  355. package/src/functional/result.test.mts +5 -4
  356. package/src/globals.d.mts +83 -0
  357. package/src/guard/is-non-empty-string.test.mts +1 -1
  358. package/src/guard/is-non-null-object.test.mts +3 -3
  359. package/src/guard/is-primitive.test.mts +3 -3
  360. package/src/guard/is-type.test.mts +3 -3
  361. package/src/index.mts +0 -1
  362. package/src/number/branded-types/finite-number.mts +7 -7
  363. package/src/number/branded-types/int.mts +7 -7
  364. package/src/number/branded-types/int16.mts +9 -9
  365. package/src/number/branded-types/int32.mts +9 -9
  366. package/src/number/branded-types/non-negative-finite-number.mts +8 -8
  367. package/src/number/branded-types/non-negative-int16.mts +9 -9
  368. package/src/number/branded-types/non-negative-int32.mts +9 -9
  369. package/src/number/branded-types/non-zero-finite-number.mts +7 -7
  370. package/src/number/branded-types/non-zero-int.mts +7 -7
  371. package/src/number/branded-types/non-zero-int16.mts +9 -9
  372. package/src/number/branded-types/non-zero-int32.mts +9 -9
  373. package/src/number/branded-types/non-zero-safe-int.mts +9 -9
  374. package/src/number/branded-types/non-zero-uint16.mts +9 -9
  375. package/src/number/branded-types/non-zero-uint32.mts +9 -9
  376. package/src/number/branded-types/positive-finite-number.mts +8 -8
  377. package/src/number/branded-types/positive-int.mts +8 -8
  378. package/src/number/branded-types/positive-int16.mts +9 -9
  379. package/src/number/branded-types/positive-int32.mts +9 -9
  380. package/src/number/branded-types/positive-safe-int.mts +9 -9
  381. package/src/number/branded-types/positive-uint16.mts +9 -9
  382. package/src/number/branded-types/positive-uint32.mts +9 -9
  383. package/src/number/branded-types/safe-int.mts +9 -9
  384. package/src/number/branded-types/safe-uint.mts +9 -9
  385. package/src/number/branded-types/uint.mts +8 -8
  386. package/src/number/branded-types/uint16.mts +9 -9
  387. package/src/number/branded-types/uint32.mts +9 -9
  388. package/src/number/enum/int8.mts +3 -3
  389. package/src/number/enum/int8.test.mts +9 -9
  390. package/src/number/enum/uint8.mts +3 -3
  391. package/src/number/enum/uint8.test.mts +8 -8
  392. package/dist/functional/optional.d.mts +0 -482
  393. package/dist/functional/optional.d.mts.map +0 -1
  394. package/dist/functional/optional.mjs +0 -328
  395. package/dist/functional/optional.mjs.map +0 -1
  396. package/dist/functional/result.d.mts +0 -712
  397. package/dist/functional/result.d.mts.map +0 -1
  398. package/dist/functional/result.mjs +0 -539
  399. package/dist/functional/result.mjs.map +0 -1
  400. package/src/functional/optional.mts +0 -713
  401. package/src/functional/result.mts +0 -1087
@@ -1 +0,0 @@
1
- {"version":3,"file":"result.d.mts","sourceRoot":"","sources":["../../src/functional/result.mts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,2EAA2E;AAC3E,QAAA,MAAM,aAAa,6BAA6B,CAAC;AAEjD,4EAA4E;AAC5E,QAAA,MAAM,cAAc,8BAA8B,CAAC;AAEnD;;;;GAIG;AACH,KAAK,GAAG,CAAC,CAAC,IAAI,QAAQ,CAAC;IACrB;;;OAGG;IACH,KAAK,EAAE,OAAO,aAAa,CAAC;IAE5B,yBAAyB;IACzB,KAAK,EAAE,CAAC,CAAC;CACV,CAAC,CAAC;AAEH;;;;GAIG;AACH,KAAK,IAAI,CAAC,CAAC,IAAI,QAAQ,CAAC;IACtB;;;OAGG;IACH,KAAK,EAAE,OAAO,cAAc,CAAC;IAE7B,uBAAuB;IACvB,KAAK,EAAE,CAAC,CAAC;CACV,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AAE5C;;;GAGG;AACH,yBAAiB,MAAM,CAAC;IACtB;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,MAAM,QAAQ,GACnB,eAAe,OAAO,KACrB,aAAa,IAAI,MAAM,CAAC,OAAO,EAAE,OAAO,CAKE,CAAC;IAE9C;;;;OAIG;IACH,MAAM,MAAM,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;IAE3B;;;;OAIG;IACH,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;IAE7B;;;OAGG;IACH,MAAM,MAAM,IAAI,GAAG,MA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;OAwBG;IACH,MAAM,CAAC,MAAM,UAAU,GAAI,CAAC,SAAS,IAAI,EACvC,QAAQ,CAAC,KACR,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CACyC,CAAC;IAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,MAAM,UAAU,MAAM,CAAC,CAAC,SAAS,IAAI,EAAE,EAAE,SAAS,IAAI,EACpD,MAAM,EAAE,CAAC,EACT,WAAW,EAAE,EAAE,GACd,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;IAGtB,MAAM,UAAU,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EACjC,WAAW,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAC1B,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAwB3D;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,MAAM,CAAC,MAAM,GAAG,GAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAChC,SAAS,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,EACvB,SAAS,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,KACtB,MAAM,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,CAKvB,CAAC;;CACf"}
@@ -1,539 +0,0 @@
1
- import { isRecord } from '../guard/is-record.mjs';
2
- import { unknownToString } from '../others/unknown-to-string.mjs';
3
- import { Optional } from './optional.mjs';
4
-
5
- /** @internal String literal tag to identify the 'Ok' variant of Result. */
6
- const OkTypeTagName = 'ts-data-forge::Result.ok';
7
- /** @internal String literal tag to identify the 'Err' variant of Result. */
8
- const ErrTypeTagName = 'ts-data-forge::Result.err';
9
- /**
10
- * Namespace for the `Result` type and related functions. Provides utilities to
11
- * handle operations that can succeed or fail.
12
- */
13
- var Result;
14
- (function (Result) {
15
- /**
16
- * Checks if the given value is a `Result`.
17
- *
18
- * @example
19
- *
20
- * ```ts
21
- * const okValue = Result.ok('success');
22
- * const errValue = Result.err(new Error('failure'));
23
- * const notResult = { $$tag: 'ts-data-forge::Result.ok' };
24
- *
25
- * assert.ok(Result.isResult(okValue));
26
- * assert.ok(Result.isResult(errValue));
27
- * assert.notOk(Result.isResult(notResult));
28
- * ```
29
- *
30
- * @param maybeOptional The value to check.
31
- * @returns `true` if the value is a `Result`, otherwise `false`.
32
- */
33
- Result.isResult = (maybeOptional) => isRecord(maybeOptional) &&
34
- Object.hasOwn(maybeOptional, '$$tag') &&
35
- Object.hasOwn(maybeOptional, 'value') &&
36
- (maybeOptional['$$tag'] === ErrTypeTagName ||
37
- maybeOptional['$$tag'] === OkTypeTagName);
38
- /**
39
- * Creates a `Result.Ok` containing the given success value.
40
- *
41
- * Use this constructor when an operation succeeds and you want to wrap the
42
- * successful result in a Result type for consistent error handling.
43
- *
44
- * @example
45
- *
46
- * ```ts
47
- * const success = Result.ok({ id: 1 });
48
- * const failure = Result.err(new Error('missing data'));
49
- *
50
- * assert.deepStrictEqual(success, {
51
- * $$tag: 'ts-data-forge::Result.ok',
52
- * value: { id: 1 },
53
- * });
54
- * assert.ok(Result.isErr(failure));
55
- * ```
56
- *
57
- * @template S The type of the success value.
58
- * @param value The success value.
59
- * @returns A `Result.Ok<S>` containing the value.
60
- */
61
- Result.ok = (value) => ({
62
- $$tag: OkTypeTagName,
63
- value,
64
- });
65
- /**
66
- * Creates a `Result.Err` containing the given error value.
67
- *
68
- * Use this constructor when an operation fails and you want to wrap the error
69
- * information in a Result type for consistent error handling.
70
- *
71
- * @example
72
- *
73
- * ```ts
74
- * const success = Result.ok({ id: 1 });
75
- * const failure = Result.err(new Error('missing data'));
76
- *
77
- * assert.deepStrictEqual(success, {
78
- * $$tag: 'ts-data-forge::Result.ok',
79
- * value: { id: 1 },
80
- * });
81
- * assert.ok(Result.isErr(failure));
82
- * ```
83
- *
84
- * @template E The type of the error value.
85
- * @param value The error value.
86
- * @returns A `Result.Err<E>` containing the value.
87
- */
88
- Result.err = (value) => ({
89
- $$tag: ErrTypeTagName,
90
- value,
91
- });
92
- /**
93
- * @internal
94
- * Default string conversion function using native String constructor.
95
- */
96
- const toStr_ = String;
97
- /**
98
- * Checks if a `Result` is `Result.Ok`. Acts as a type guard, narrowing the
99
- * type to the success variant.
100
- *
101
- * This function is essential for type-safe Result handling, allowing
102
- * TypeScript to understand that subsequent operations will work with the
103
- * success value rather than the error value.
104
- *
105
- * @example
106
- *
107
- * ```ts
108
- * const operation = Result.ok(3);
109
- * const failure = Result.err('error');
110
- *
111
- * if (Result.isOk(operation)) {
112
- * const value: number = operation.value;
113
- * assert(value === 3);
114
- * }
115
- *
116
- * assert.ok(Result.isErr(failure));
117
- * ```
118
- *
119
- * @template R The `Result.Base` type to check.
120
- * @param result The `Result` to check.
121
- * @returns `true` if the `Result` is `Result.Ok`, otherwise `false`.
122
- */
123
- Result.isOk = (result) => result.$$tag === OkTypeTagName;
124
- /**
125
- * Checks if a `Result` is `Result.Err`. Acts as a type guard, narrowing the
126
- * type to the error variant.
127
- *
128
- * This function is essential for type-safe Result handling, allowing
129
- * TypeScript to understand that subsequent operations will work with the
130
- * error value rather than the success value.
131
- *
132
- * @example
133
- *
134
- * ```ts
135
- * const operation = Result.ok(3);
136
- * const failure = Result.err('error');
137
- *
138
- * if (Result.isOk(operation)) {
139
- * const value: number = operation.value;
140
- * assert(value === 3);
141
- * }
142
- *
143
- * assert.ok(Result.isErr(failure));
144
- * ```
145
- *
146
- * @template R The `Result.Base` type to check.
147
- * @param result The `Result` to check.
148
- * @returns `true` if the `Result` is `Result.Err`, otherwise `false`.
149
- */
150
- Result.isErr = (result) => result.$$tag === ErrTypeTagName;
151
- /**
152
- * Unwraps a `Result`, returning the success value. Throws an error if the
153
- * `Result` is `Result.Err`.
154
- *
155
- * This is useful when you're confident that a Result should contain a success
156
- * value and want to treat errors as exceptional conditions. The error message
157
- * will be constructed from the error value using the provided string
158
- * conversion function.
159
- *
160
- * @example
161
- *
162
- * ```ts
163
- * const okResult = Result.ok('data');
164
- * const errResult = Result.err(new Error('fail'));
165
- *
166
- * assert(Result.unwrapThrow(okResult) === 'data');
167
- * assert.throws(() => Result.unwrapThrow(errResult), /fail/u);
168
- * ```
169
- *
170
- * @template R The `Result.Base` type to unwrap.
171
- * @param result The `Result` to unwrap.
172
- * @param toStr An optional function to convert the error value to a string
173
- * for the error message. Defaults to `String`.
174
- * @returns The success value if `Result.Ok`.
175
- * @throws {Error} Error with the stringified error value if the `Result` is
176
- * `Result.Err`.
177
- */
178
- Result.unwrapThrow = (result, toStr = toStr_) => {
179
- if (Result.isErr(result)) {
180
- // eslint-disable-next-line total-functions/no-unsafe-type-assertion
181
- throw new Error(toStr(result.value));
182
- }
183
- // eslint-disable-next-line total-functions/no-unsafe-type-assertion
184
- return result.value;
185
- };
186
- function unwrapOk(result) {
187
- return Result.isErr(result)
188
- ? undefined
189
- : // eslint-disable-next-line total-functions/no-unsafe-type-assertion
190
- result.value;
191
- }
192
- Result.unwrapOk = unwrapOk;
193
- function unwrapOkOr(...args) {
194
- switch (args.length) {
195
- case 2: {
196
- // Direct version: first argument is result
197
- const [result, defaultValue] = args;
198
- // eslint-disable-next-line total-functions/no-unsafe-type-assertion
199
- return Result.isErr(result) ? defaultValue : result.value;
200
- }
201
- case 1: {
202
- // Curried version: first argument is default value
203
- const [defaultValue] = args;
204
- return (result) => unwrapOkOr(result, defaultValue);
205
- }
206
- }
207
- }
208
- Result.unwrapOkOr = unwrapOkOr;
209
- /**
210
- * Unwraps a `Result`, returning the error value. Throws an error if the
211
- * `Result` is `Result.Ok`.
212
- *
213
- * This function is used when you expect a Result to be an error and want to
214
- * extract the error value. If the Result is unexpectedly Ok, it will throw an
215
- * error with information about the unexpected success value.
216
- *
217
- * @example
218
- *
219
- * ```ts
220
- * const errResult = Result.err(new Error('broken'));
221
- * const okResult = Result.ok('value');
222
- *
223
- * assert(Result.unwrapErrThrow(errResult).message === 'broken');
224
- * assert.throws(() => Result.unwrapErrThrow(okResult), /Expected Err/u);
225
- * ```
226
- *
227
- * @template R The `Result.Base` type to unwrap.
228
- * @param result The `Result` to unwrap.
229
- * @param toStr An optional function to convert the success value to a string
230
- * for the error message when the Result is unexpectedly Ok. Defaults to
231
- * `String`.
232
- * @returns The error value if `Result.Err`.
233
- * @throws {Error} Error with message "Expected Err but got Ok: {value}" if
234
- * the `Result` is `Result.Ok`.
235
- */
236
- Result.unwrapErrThrow = (result, toStr = toStr_) => {
237
- if (Result.isOk(result)) {
238
- throw new Error(
239
- // eslint-disable-next-line total-functions/no-unsafe-type-assertion
240
- `Expected Err but got Ok: ${toStr(result.value)}`);
241
- }
242
- // eslint-disable-next-line total-functions/no-unsafe-type-assertion
243
- return result.value;
244
- };
245
- /**
246
- * Unwraps a `Result`, returning the error value or `undefined` if it is
247
- * `Result.Ok`.
248
- *
249
- * This provides a safe way to extract error values from Results without
250
- * throwing exceptions. Useful for error handling patterns where you want to
251
- * check for specific error conditions.
252
- *
253
- * @example
254
- *
255
- * ```ts
256
- * const okResult = Result.ok('data');
257
- * const errResult = Result.err('problem');
258
- *
259
- * // Result.unwrapErr returns undefined for Ok results
260
- * // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
261
- * assert(Result.unwrapErr(okResult) === undefined);
262
- *
263
- * // Result.unwrapErr returns the error value for Err results
264
- *
265
- * assert(Result.unwrapErr(errResult) === 'problem');
266
- * ```
267
- *
268
- * @template R The `Result.Base` type to unwrap.
269
- * @param result The `Result` to unwrap.
270
- * @returns The error value if `Result.Err`, otherwise `undefined`.
271
- */
272
- Result.unwrapErr = (result) =>
273
- // eslint-disable-next-line total-functions/no-unsafe-type-assertion
274
- Result.isErr(result) ? result.value : undefined;
275
- function unwrapErrOr(...args) {
276
- switch (args.length) {
277
- case 2: {
278
- // Direct version: first argument is result
279
- const [result, defaultValue] = args;
280
- // eslint-disable-next-line total-functions/no-unsafe-type-assertion
281
- return Result.isErr(result) ? result.value : defaultValue;
282
- }
283
- case 1: {
284
- // Curried version: first argument is default value
285
- const [defaultValue] = args;
286
- return (result) => unwrapErrOr(result, defaultValue);
287
- }
288
- }
289
- }
290
- Result.unwrapErrOr = unwrapErrOr;
291
- function map(...args) {
292
- switch (args.length) {
293
- case 2: {
294
- const [result, mapFn] = args;
295
- return Result.isErr(result)
296
- ? // eslint-disable-next-line total-functions/no-unsafe-type-assertion
297
- result
298
- : // eslint-disable-next-line total-functions/no-unsafe-type-assertion
299
- Result.ok(mapFn(result.value));
300
- }
301
- case 1: {
302
- // Curried version: first argument is mapping function
303
- const [mapFn] = args;
304
- return (result) => map(result, mapFn);
305
- }
306
- }
307
- }
308
- Result.map = map;
309
- function mapErr(...args) {
310
- switch (args.length) {
311
- case 2: {
312
- const [result, mapFn] = args;
313
- return Result.isOk(result)
314
- ? // eslint-disable-next-line total-functions/no-unsafe-type-assertion
315
- result
316
- : // eslint-disable-next-line total-functions/no-unsafe-type-assertion
317
- Result.err(mapFn(result.value));
318
- }
319
- case 1: {
320
- // Curried version: first argument is mapping function
321
- const [mapFn] = args;
322
- return (result) => mapErr(result, mapFn);
323
- }
324
- }
325
- }
326
- Result.mapErr = mapErr;
327
- function fold(...args) {
328
- switch (args.length) {
329
- case 3: {
330
- const [result, mapFn, mapErrFn] = args;
331
- return Result.isOk(result)
332
- ? // eslint-disable-next-line total-functions/no-unsafe-type-assertion
333
- Result.ok(mapFn(result.value))
334
- : // eslint-disable-next-line total-functions/no-unsafe-type-assertion
335
- Result.err(mapErrFn(result.value));
336
- }
337
- case 2: {
338
- const [mapFn, mapErrFn] = args;
339
- return (result) => Result.isOk(result) ? Result.ok(mapFn(result.value)) : Result.err(mapErrFn(result.value));
340
- }
341
- }
342
- }
343
- Result.fold = fold;
344
- function flatMap(...args) {
345
- switch (args.length) {
346
- case 2: {
347
- const [result, flatMapFn] = args;
348
- return Result.isErr(result)
349
- ? // eslint-disable-next-line total-functions/no-unsafe-type-assertion
350
- result
351
- : // eslint-disable-next-line total-functions/no-unsafe-type-assertion
352
- flatMapFn(result.value);
353
- }
354
- case 1: {
355
- const [flatMapFn] = args;
356
- return (result) => Result.isErr(result) ? result : flatMapFn(result.value);
357
- }
358
- }
359
- }
360
- Result.flatMap = flatMap;
361
- function expectToBe(...args) {
362
- switch (args.length) {
363
- case 2: {
364
- // Direct version: first argument is result
365
- const [result, message] = args;
366
- if (Result.isOk(result)) {
367
- return unwrapOk(result);
368
- }
369
- throw new Error(message);
370
- }
371
- case 1: {
372
- // Curried version: first argument is message
373
- const [message] = args;
374
- return (result) => expectToBe(result, message);
375
- }
376
- }
377
- }
378
- Result.expectToBe = expectToBe;
379
- /**
380
- * Converts a Promise into a Promise that resolves to a `Result`. If the input
381
- * Promise resolves, the `Result` will be `Ok` with the resolved value. If the
382
- * input Promise rejects, the `Result` will be `Err` with the rejection
383
- * reason.
384
- *
385
- * @example
386
- *
387
- * ```ts
388
- * const successPromise = Result.fromPromise(Promise.resolve('ok'));
389
- * const failurePromise = Result.fromPromise(Promise.reject(new Error('fail')));
390
- *
391
- * const resolved = await successPromise;
392
- * const rejected = await failurePromise;
393
- *
394
- * assert.deepStrictEqual(resolved, Result.ok('ok'));
395
- * assert.ok(Result.isErr(rejected));
396
- * ```
397
- *
398
- * @template P The type of the input Promise.
399
- * @param promise The Promise to convert.
400
- * @returns A Promise that resolves to `Result<UnwrapPromise<P>, unknown>`.
401
- */
402
- Result.fromPromise = (promise) =>
403
- // eslint-disable-next-line total-functions/no-unsafe-type-assertion
404
- promise.then((v) => Result.ok(v)).catch(Result.err);
405
- /**
406
- * Wraps a function that may throw an exception in a `Result`.
407
- *
408
- * This is a fundamental utility for converting traditional exception-based
409
- * error handling into Result-based error handling. Any thrown value is
410
- * converted to an Error object for consistent error handling.
411
- *
412
- * If the function executes successfully, returns `Result.Ok` with the result.
413
- * If the function throws, returns `Result.Err` with the caught error.
414
- *
415
- * @example
416
- *
417
- * ```ts
418
- * const success = Result.fromThrowable(() => 1 + 1);
419
- * const failure = Result.fromThrowable(() => {
420
- * throw new Error('boom');
421
- * });
422
- *
423
- * assert.deepStrictEqual(success, Result.ok(2));
424
- * assert.ok(Result.isErr(failure));
425
- * ```
426
- *
427
- * @template T The return type of the function.
428
- * @param fn The function to execute that may throw.
429
- * @returns A `Result<T, Error>` containing either the successful result or
430
- * the caught error.
431
- */
432
- Result.fromThrowable = (fn) => {
433
- try {
434
- return Result.ok(fn());
435
- }
436
- catch (error) {
437
- if (Error.isError(error)) {
438
- return Result.err(error);
439
- }
440
- const msg = unknownToString(error);
441
- return Result.err(new Error(msg));
442
- }
443
- };
444
- /**
445
- * Swaps the success and error values of a `Result`.
446
- *
447
- * @example
448
- *
449
- * ```ts
450
- * const okValue = Result.ok('value');
451
- * const errValue = Result.err('error');
452
- *
453
- * assert.deepStrictEqual(Result.swap(okValue), Result.err('value'));
454
- * assert.deepStrictEqual(Result.swap(errValue), Result.ok('error'));
455
- * ```
456
- *
457
- * @template R The input `Result.Base` type.
458
- * @param result The `Result` to swap.
459
- * @returns A new `Result` with success and error swapped.
460
- */
461
- Result.swap = (result) =>
462
- // eslint-disable-next-line total-functions/no-unsafe-type-assertion
463
- Result.isOk(result) ? Result.err(unwrapOk(result)) : Result.ok(result.value);
464
- /**
465
- * Converts a `Result` to an `Optional`.
466
- *
467
- * This conversion is useful when you want to discard error information and
468
- * only care about whether an operation succeeded. The error information is
469
- * lost in this conversion, so use it when error details are not needed.
470
- *
471
- * If the `Result` is `Ok`, returns `Some` with the value. If the `Result` is
472
- * `Err`, returns `None`.
473
- *
474
- * @example
475
- *
476
- * ```ts
477
- * const okValue = Result.ok(7);
478
- * const errValue = Result.err('fail');
479
- *
480
- * assert.deepStrictEqual(Result.toOptional(okValue), Optional.some(7));
481
- * assert.deepStrictEqual(Result.toOptional(errValue), Optional.none);
482
- * ```
483
- *
484
- * @template R The input `Result.Base` type.
485
- * @param result The `Result` to convert.
486
- * @returns An `Optional<UnwrapOk<R>>` containing the success value or
487
- * representing `None`.
488
- */
489
- Result.toOptional = (result) => Result.isOk(result) ? Optional.some(unwrapOk(result)) : Optional.none;
490
- function orElse(...args) {
491
- switch (args.length) {
492
- case 2: {
493
- const [result, alternative] = args;
494
- return Result.isOk(result) ? result : alternative;
495
- }
496
- case 1: {
497
- // Curried version: one argument (alternative) provided
498
- const [alternative] = args;
499
- return (result) => orElse(result, alternative);
500
- }
501
- }
502
- }
503
- Result.orElse = orElse;
504
- /**
505
- * Combines two `Result` values into a single `Result` containing a tuple. If
506
- * either `Result` is `Err`, returns the first `Err` encountered.
507
- *
508
- * @example
509
- *
510
- * ```ts
511
- * const first = Result.ok('left');
512
- * const second = Result.ok(1);
513
- *
514
- * const expected: readonly [string, number] = ['left', 1];
515
- *
516
- * assert.deepStrictEqual(Result.zip(first, second), Result.ok(expected));
517
- * assert.deepStrictEqual(
518
- * Result.zip(first, Result.err('error')),
519
- * Result.err('error'),
520
- * );
521
- * ```
522
- *
523
- * @template S1 The success type of the first `Result`.
524
- * @template E1 The error type of the first `Result`.
525
- * @template S2 The success type of the second `Result`.
526
- * @template E2 The error type of the second `Result`.
527
- * @param resultA The first `Result`.
528
- * @param resultB The second `Result`.
529
- * @returns A `Result` containing a tuple of both values, or the first `Err`.
530
- */
531
- Result.zip = (resultA, resultB) => Result.isOk(resultA)
532
- ? Result.isOk(resultB)
533
- ? Result.ok([resultA.value, resultB.value])
534
- : resultB
535
- : resultA;
536
- })(Result || (Result = {}));
537
-
538
- export { Result };
539
- //# sourceMappingURL=result.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result.mjs","sources":["../../src/functional/result.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAIA;AACA,MAAM,aAAa,GAAG,0BAA0B;AAEhD;AACA,MAAM,cAAc,GAAG,2BAA2B;AA0ClD;;;AAGG;AACG,IAAW;AAAjB,CAAA,UAAiB,M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