ts-data-forge 14.6.3 → 14.7.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 (560) hide show
  1. package/README.md +2 -1
  2. package/dist/array/impl/array-utils-modification.mjs +1 -1
  3. package/dist/array/impl/array-utils-transformation.mjs +2 -2
  4. package/dist/expect-type.d.mts +2 -70
  5. package/dist/expect-type.d.mts.map +1 -1
  6. package/dist/expect-type.mjs +1 -68
  7. package/dist/expect-type.mjs.map +1 -1
  8. package/dist/functional/index.d.mts +11 -6
  9. package/dist/functional/index.d.mts.map +1 -1
  10. package/dist/functional/index.mjs +10 -6
  11. package/dist/functional/index.mjs.map +1 -1
  12. package/dist/guard/has-key.d.mts +2 -51
  13. package/dist/guard/has-key.d.mts.map +1 -1
  14. package/dist/guard/has-key.mjs +1 -41
  15. package/dist/guard/has-key.mjs.map +1 -1
  16. package/dist/guard/is-non-null-object.d.mts +2 -34
  17. package/dist/guard/is-non-null-object.d.mts.map +1 -1
  18. package/dist/guard/is-non-null-object.mjs +1 -34
  19. package/dist/guard/is-non-null-object.mjs.map +1 -1
  20. package/dist/guard/is-record.d.mts +2 -89
  21. package/dist/guard/is-record.d.mts.map +1 -1
  22. package/dist/guard/is-record.mjs +1 -88
  23. package/dist/guard/is-record.mjs.map +1 -1
  24. package/dist/guard/key-is-in.d.mts +2 -42
  25. package/dist/guard/key-is-in.d.mts.map +1 -1
  26. package/dist/guard/key-is-in.mjs +1 -40
  27. package/dist/guard/key-is-in.mjs.map +1 -1
  28. package/dist/number/num.d.mts +9 -1
  29. package/dist/number/num.d.mts.map +1 -1
  30. package/dist/number/num.mjs +24 -16
  31. package/dist/number/num.mjs.map +1 -1
  32. package/dist/others/index.d.mts +1 -0
  33. package/dist/others/index.d.mts.map +1 -1
  34. package/dist/others/index.mjs +1 -0
  35. package/dist/others/index.mjs.map +1 -1
  36. package/dist/others/panic-error.d.mts +9 -0
  37. package/dist/others/panic-error.d.mts.map +1 -0
  38. package/dist/others/panic-error.mjs +9 -0
  39. package/dist/others/panic-error.mjs.map +1 -0
  40. package/dist/others/unknown-to-string.d.mts +2 -37
  41. package/dist/others/unknown-to-string.d.mts.map +1 -1
  42. package/dist/others/unknown-to-string.mjs +1 -92
  43. package/dist/others/unknown-to-string.mjs.map +1 -1
  44. package/dist/types.d.mts +1 -41
  45. package/dist/types.d.mts.map +1 -1
  46. package/dist/types.mjs +0 -1
  47. package/dist/types.mjs.map +1 -1
  48. package/package.json +6 -6
  49. package/src/expect-type.mts +2 -78
  50. package/src/functional/index.mts +31 -6
  51. package/src/guard/has-key.mts +2 -72
  52. package/src/guard/is-non-null-object.mts +2 -36
  53. package/src/guard/is-record.mts +2 -95
  54. package/src/guard/key-is-in.mts +2 -49
  55. package/src/number/num.mts +36 -28
  56. package/src/others/index.mts +1 -0
  57. package/src/others/panic-error.mts +8 -0
  58. package/src/others/unknown-to-string.mts +2 -111
  59. package/src/types.mts +4 -54
  60. package/dist/functional/async-result/async-result.d.mts +0 -16
  61. package/dist/functional/async-result/async-result.d.mts.map +0 -1
  62. package/dist/functional/async-result/async-result.mjs +0 -2
  63. package/dist/functional/async-result/async-result.mjs.map +0 -1
  64. package/dist/functional/async-result/impl/async-result-flat-map.d.mts +0 -39
  65. package/dist/functional/async-result/impl/async-result-flat-map.d.mts.map +0 -1
  66. package/dist/functional/async-result/impl/async-result-flat-map.mjs +0 -23
  67. package/dist/functional/async-result/impl/async-result-flat-map.mjs.map +0 -1
  68. package/dist/functional/async-result/impl/async-result-from-promise.d.mts +0 -47
  69. package/dist/functional/async-result/impl/async-result-from-promise.d.mts.map +0 -1
  70. package/dist/functional/async-result/impl/async-result-from-promise.mjs +0 -10
  71. package/dist/functional/async-result/impl/async-result-from-promise.mjs.map +0 -1
  72. package/dist/functional/async-result/impl/async-result-from-throwable.d.mts +0 -53
  73. package/dist/functional/async-result/impl/async-result-from-throwable.d.mts.map +0 -1
  74. package/dist/functional/async-result/impl/async-result-from-throwable.mjs +0 -15
  75. package/dist/functional/async-result/impl/async-result-from-throwable.mjs.map +0 -1
  76. package/dist/functional/async-result/impl/async-result-map-err.d.mts +0 -35
  77. package/dist/functional/async-result/impl/async-result-map-err.d.mts.map +0 -1
  78. package/dist/functional/async-result/impl/async-result-map-err.mjs +0 -20
  79. package/dist/functional/async-result/impl/async-result-map-err.mjs.map +0 -1
  80. package/dist/functional/async-result/impl/async-result-map.d.mts +0 -45
  81. package/dist/functional/async-result/impl/async-result-map.d.mts.map +0 -1
  82. package/dist/functional/async-result/impl/async-result-map.mjs +0 -20
  83. package/dist/functional/async-result/impl/async-result-map.mjs.map +0 -1
  84. package/dist/functional/async-result/impl/async-result-unwrap-or.d.mts +0 -34
  85. package/dist/functional/async-result/impl/async-result-unwrap-or.d.mts.map +0 -1
  86. package/dist/functional/async-result/impl/async-result-unwrap-or.mjs +0 -37
  87. package/dist/functional/async-result/impl/async-result-unwrap-or.mjs.map +0 -1
  88. package/dist/functional/async-result/impl/index.d.mts +0 -8
  89. package/dist/functional/async-result/impl/index.d.mts.map +0 -1
  90. package/dist/functional/async-result/impl/index.mjs +0 -8
  91. package/dist/functional/async-result/impl/index.mjs.map +0 -1
  92. package/dist/functional/async-result/impl/types.d.mts +0 -45
  93. package/dist/functional/async-result/impl/types.d.mts.map +0 -1
  94. package/dist/functional/async-result/impl/types.mjs +0 -2
  95. package/dist/functional/async-result/impl/types.mjs.map +0 -1
  96. package/dist/functional/async-result/index.d.mts +0 -2
  97. package/dist/functional/async-result/index.d.mts.map +0 -1
  98. package/dist/functional/async-result/index.mjs +0 -2
  99. package/dist/functional/async-result/index.mjs.map +0 -1
  100. package/dist/functional/match.d.mts +0 -80
  101. package/dist/functional/match.d.mts.map +0 -1
  102. package/dist/functional/match.mjs +0 -31
  103. package/dist/functional/match.mjs.map +0 -1
  104. package/dist/functional/optional/impl/index.d.mts +0 -19
  105. package/dist/functional/optional/impl/index.d.mts.map +0 -1
  106. package/dist/functional/optional/impl/index.mjs +0 -19
  107. package/dist/functional/optional/impl/index.mjs.map +0 -1
  108. package/dist/functional/optional/impl/optional-expect-to-be.d.mts +0 -37
  109. package/dist/functional/optional/impl/optional-expect-to-be.d.mts.map +0 -1
  110. package/dist/functional/optional/impl/optional-expect-to-be.mjs +0 -22
  111. package/dist/functional/optional/impl/optional-expect-to-be.mjs.map +0 -1
  112. package/dist/functional/optional/impl/optional-filter.d.mts +0 -33
  113. package/dist/functional/optional/impl/optional-filter.d.mts.map +0 -1
  114. package/dist/functional/optional/impl/optional-filter.mjs +0 -25
  115. package/dist/functional/optional/impl/optional-filter.mjs.map +0 -1
  116. package/dist/functional/optional/impl/optional-flat-map.d.mts +0 -39
  117. package/dist/functional/optional/impl/optional-flat-map.d.mts.map +0 -1
  118. package/dist/functional/optional/impl/optional-flat-map.mjs +0 -18
  119. package/dist/functional/optional/impl/optional-flat-map.mjs.map +0 -1
  120. package/dist/functional/optional/impl/optional-from-nullable.d.mts +0 -27
  121. package/dist/functional/optional/impl/optional-from-nullable.d.mts.map +0 -1
  122. package/dist/functional/optional/impl/optional-from-nullable.mjs +0 -28
  123. package/dist/functional/optional/impl/optional-from-nullable.mjs.map +0 -1
  124. package/dist/functional/optional/impl/optional-is-none.d.mts +0 -23
  125. package/dist/functional/optional/impl/optional-is-none.d.mts.map +0 -1
  126. package/dist/functional/optional/impl/optional-is-none.mjs +0 -22
  127. package/dist/functional/optional/impl/optional-is-none.mjs.map +0 -1
  128. package/dist/functional/optional/impl/optional-is-optional.d.mts +0 -21
  129. package/dist/functional/optional/impl/optional-is-optional.d.mts.map +0 -1
  130. package/dist/functional/optional/impl/optional-is-optional.mjs +0 -26
  131. package/dist/functional/optional/impl/optional-is-optional.mjs.map +0 -1
  132. package/dist/functional/optional/impl/optional-is-some.d.mts +0 -24
  133. package/dist/functional/optional/impl/optional-is-some.d.mts.map +0 -1
  134. package/dist/functional/optional/impl/optional-is-some.mjs +0 -23
  135. package/dist/functional/optional/impl/optional-is-some.mjs.map +0 -1
  136. package/dist/functional/optional/impl/optional-map.d.mts +0 -34
  137. package/dist/functional/optional/impl/optional-map.d.mts.map +0 -1
  138. package/dist/functional/optional/impl/optional-map.mjs +0 -22
  139. package/dist/functional/optional/impl/optional-map.mjs.map +0 -1
  140. package/dist/functional/optional/impl/optional-match.d.mts +0 -48
  141. package/dist/functional/optional/impl/optional-match.d.mts.map +0 -1
  142. package/dist/functional/optional/impl/optional-match.mjs +0 -20
  143. package/dist/functional/optional/impl/optional-match.mjs.map +0 -1
  144. package/dist/functional/optional/impl/optional-none.d.mts +0 -19
  145. package/dist/functional/optional/impl/optional-none.d.mts.map +0 -1
  146. package/dist/functional/optional/impl/optional-none.mjs +0 -19
  147. package/dist/functional/optional/impl/optional-none.mjs.map +0 -1
  148. package/dist/functional/optional/impl/optional-or-else.d.mts +0 -43
  149. package/dist/functional/optional/impl/optional-or-else.d.mts.map +0 -1
  150. package/dist/functional/optional/impl/optional-or-else.mjs +0 -16
  151. package/dist/functional/optional/impl/optional-or-else.mjs.map +0 -1
  152. package/dist/functional/optional/impl/optional-some.d.mts +0 -22
  153. package/dist/functional/optional/impl/optional-some.d.mts.map +0 -1
  154. package/dist/functional/optional/impl/optional-some.mjs +0 -25
  155. package/dist/functional/optional/impl/optional-some.mjs.map +0 -1
  156. package/dist/functional/optional/impl/optional-to-nullable.d.mts +0 -30
  157. package/dist/functional/optional/impl/optional-to-nullable.d.mts.map +0 -1
  158. package/dist/functional/optional/impl/optional-to-nullable.mjs +0 -30
  159. package/dist/functional/optional/impl/optional-to-nullable.mjs.map +0 -1
  160. package/dist/functional/optional/impl/optional-unwrap-or.d.mts +0 -37
  161. package/dist/functional/optional/impl/optional-unwrap-or.d.mts.map +0 -1
  162. package/dist/functional/optional/impl/optional-unwrap-or.mjs +0 -16
  163. package/dist/functional/optional/impl/optional-unwrap-or.mjs.map +0 -1
  164. package/dist/functional/optional/impl/optional-unwrap-throw.d.mts +0 -31
  165. package/dist/functional/optional/impl/optional-unwrap-throw.d.mts.map +0 -1
  166. package/dist/functional/optional/impl/optional-unwrap-throw.mjs +0 -36
  167. package/dist/functional/optional/impl/optional-unwrap-throw.mjs.map +0 -1
  168. package/dist/functional/optional/impl/optional-unwrap.d.mts +0 -32
  169. package/dist/functional/optional/impl/optional-unwrap.d.mts.map +0 -1
  170. package/dist/functional/optional/impl/optional-unwrap.mjs +0 -8
  171. package/dist/functional/optional/impl/optional-unwrap.mjs.map +0 -1
  172. package/dist/functional/optional/impl/optional-zip.d.mts +0 -35
  173. package/dist/functional/optional/impl/optional-zip.d.mts.map +0 -1
  174. package/dist/functional/optional/impl/optional-zip.mjs +0 -39
  175. package/dist/functional/optional/impl/optional-zip.mjs.map +0 -1
  176. package/dist/functional/optional/impl/tag.d.mts +0 -6
  177. package/dist/functional/optional/impl/tag.d.mts.map +0 -1
  178. package/dist/functional/optional/impl/tag.mjs +0 -4
  179. package/dist/functional/optional/impl/tag.mjs.map +0 -1
  180. package/dist/functional/optional/impl/types.d.mts +0 -24
  181. package/dist/functional/optional/impl/types.d.mts.map +0 -1
  182. package/dist/functional/optional/impl/types.mjs +0 -2
  183. package/dist/functional/optional/impl/types.mjs.map +0 -1
  184. package/dist/functional/optional/index.d.mts +0 -2
  185. package/dist/functional/optional/index.d.mts.map +0 -1
  186. package/dist/functional/optional/index.mjs +0 -2
  187. package/dist/functional/optional/index.mjs.map +0 -1
  188. package/dist/functional/optional/optional.d.mts +0 -16
  189. package/dist/functional/optional/optional.d.mts.map +0 -1
  190. package/dist/functional/optional/optional.mjs +0 -2
  191. package/dist/functional/optional/optional.mjs.map +0 -1
  192. package/dist/functional/pipe.d.mts +0 -102
  193. package/dist/functional/pipe.d.mts.map +0 -1
  194. package/dist/functional/pipe.mjs +0 -45
  195. package/dist/functional/pipe.mjs.map +0 -1
  196. package/dist/functional/result/impl/index.d.mts +0 -28
  197. package/dist/functional/result/impl/index.d.mts.map +0 -1
  198. package/dist/functional/result/impl/index.mjs +0 -28
  199. package/dist/functional/result/impl/index.mjs.map +0 -1
  200. package/dist/functional/result/impl/result-err.d.mts +0 -28
  201. package/dist/functional/result/impl/result-err.d.mts.map +0 -1
  202. package/dist/functional/result/impl/result-err.mjs +0 -31
  203. package/dist/functional/result/impl/result-err.mjs.map +0 -1
  204. package/dist/functional/result/impl/result-expect-to-be.d.mts +0 -33
  205. package/dist/functional/result/impl/result-expect-to-be.d.mts.map +0 -1
  206. package/dist/functional/result/impl/result-expect-to-be.mjs +0 -23
  207. package/dist/functional/result/impl/result-expect-to-be.mjs.map +0 -1
  208. package/dist/functional/result/impl/result-flat-map.d.mts +0 -45
  209. package/dist/functional/result/impl/result-flat-map.d.mts.map +0 -1
  210. package/dist/functional/result/impl/result-flat-map.mjs +0 -21
  211. package/dist/functional/result/impl/result-flat-map.mjs.map +0 -1
  212. package/dist/functional/result/impl/result-fold.d.mts +0 -50
  213. package/dist/functional/result/impl/result-fold.d.mts.map +0 -1
  214. package/dist/functional/result/impl/result-fold.mjs +0 -23
  215. package/dist/functional/result/impl/result-fold.mjs.map +0 -1
  216. package/dist/functional/result/impl/result-from-optional.d.mts +0 -41
  217. package/dist/functional/result/impl/result-from-optional.d.mts.map +0 -1
  218. package/dist/functional/result/impl/result-from-optional.mjs +0 -21
  219. package/dist/functional/result/impl/result-from-optional.mjs.map +0 -1
  220. package/dist/functional/result/impl/result-from-promise.d.mts +0 -43
  221. package/dist/functional/result/impl/result-from-promise.d.mts.map +0 -1
  222. package/dist/functional/result/impl/result-from-promise.mjs +0 -39
  223. package/dist/functional/result/impl/result-from-promise.mjs.map +0 -1
  224. package/dist/functional/result/impl/result-from-throwable.d.mts +0 -32
  225. package/dist/functional/result/impl/result-from-throwable.d.mts.map +0 -1
  226. package/dist/functional/result/impl/result-from-throwable.mjs +0 -46
  227. package/dist/functional/result/impl/result-from-throwable.mjs.map +0 -1
  228. package/dist/functional/result/impl/result-is-err.d.mts +0 -23
  229. package/dist/functional/result/impl/result-is-err.d.mts.map +0 -1
  230. package/dist/functional/result/impl/result-is-err.mjs +0 -22
  231. package/dist/functional/result/impl/result-is-err.mjs.map +0 -1
  232. package/dist/functional/result/impl/result-is-ok.d.mts +0 -23
  233. package/dist/functional/result/impl/result-is-ok.d.mts.map +0 -1
  234. package/dist/functional/result/impl/result-is-ok.mjs +0 -22
  235. package/dist/functional/result/impl/result-is-ok.mjs.map +0 -1
  236. package/dist/functional/result/impl/result-is-result.d.mts +0 -22
  237. package/dist/functional/result/impl/result-is-result.d.mts.map +0 -1
  238. package/dist/functional/result/impl/result-is-result.mjs +0 -26
  239. package/dist/functional/result/impl/result-is-result.mjs.map +0 -1
  240. package/dist/functional/result/impl/result-map-err.d.mts +0 -39
  241. package/dist/functional/result/impl/result-map-err.d.mts.map +0 -1
  242. package/dist/functional/result/impl/result-map-err.mjs +0 -22
  243. package/dist/functional/result/impl/result-map-err.mjs.map +0 -1
  244. package/dist/functional/result/impl/result-map.d.mts +0 -39
  245. package/dist/functional/result/impl/result-map.d.mts.map +0 -1
  246. package/dist/functional/result/impl/result-map.mjs +0 -22
  247. package/dist/functional/result/impl/result-map.mjs.map +0 -1
  248. package/dist/functional/result/impl/result-match.d.mts +0 -47
  249. package/dist/functional/result/impl/result-match.d.mts.map +0 -1
  250. package/dist/functional/result/impl/result-match.mjs +0 -20
  251. package/dist/functional/result/impl/result-match.mjs.map +0 -1
  252. package/dist/functional/result/impl/result-ok.d.mts +0 -28
  253. package/dist/functional/result/impl/result-ok.d.mts.map +0 -1
  254. package/dist/functional/result/impl/result-ok.mjs +0 -31
  255. package/dist/functional/result/impl/result-ok.mjs.map +0 -1
  256. package/dist/functional/result/impl/result-or-else.d.mts +0 -40
  257. package/dist/functional/result/impl/result-or-else.d.mts.map +0 -1
  258. package/dist/functional/result/impl/result-or-else.mjs +0 -17
  259. package/dist/functional/result/impl/result-or-else.mjs.map +0 -1
  260. package/dist/functional/result/impl/result-safe-try.d.mts +0 -51
  261. package/dist/functional/result/impl/result-safe-try.d.mts.map +0 -1
  262. package/dist/functional/result/impl/result-safe-try.mjs +0 -35
  263. package/dist/functional/result/impl/result-safe-try.mjs.map +0 -1
  264. package/dist/functional/result/impl/result-safe-unwrap.d.mts +0 -36
  265. package/dist/functional/result/impl/result-safe-unwrap.d.mts.map +0 -1
  266. package/dist/functional/result/impl/result-safe-unwrap.mjs +0 -42
  267. package/dist/functional/result/impl/result-safe-unwrap.mjs.map +0 -1
  268. package/dist/functional/result/impl/result-swap.d.mts +0 -23
  269. package/dist/functional/result/impl/result-swap.d.mts.map +0 -1
  270. package/dist/functional/result/impl/result-swap.mjs +0 -27
  271. package/dist/functional/result/impl/result-swap.mjs.map +0 -1
  272. package/dist/functional/result/impl/result-to-optional.d.mts +0 -32
  273. package/dist/functional/result/impl/result-to-optional.d.mts.map +0 -1
  274. package/dist/functional/result/impl/result-to-optional.mjs +0 -32
  275. package/dist/functional/result/impl/result-to-optional.mjs.map +0 -1
  276. package/dist/functional/result/impl/result-unwrap-err-or.d.mts +0 -33
  277. package/dist/functional/result/impl/result-unwrap-err-or.d.mts.map +0 -1
  278. package/dist/functional/result/impl/result-unwrap-err-or.mjs +0 -17
  279. package/dist/functional/result/impl/result-unwrap-err-or.mjs.map +0 -1
  280. package/dist/functional/result/impl/result-unwrap-err-throw.d.mts +0 -33
  281. package/dist/functional/result/impl/result-unwrap-err-throw.d.mts.map +0 -1
  282. package/dist/functional/result/impl/result-unwrap-err-throw.mjs +0 -46
  283. package/dist/functional/result/impl/result-unwrap-err-throw.mjs.map +0 -1
  284. package/dist/functional/result/impl/result-unwrap-err.d.mts +0 -33
  285. package/dist/functional/result/impl/result-unwrap-err.d.mts.map +0 -1
  286. package/dist/functional/result/impl/result-unwrap-err.mjs +0 -34
  287. package/dist/functional/result/impl/result-unwrap-err.mjs.map +0 -1
  288. package/dist/functional/result/impl/result-unwrap-ok-or.d.mts +0 -33
  289. package/dist/functional/result/impl/result-unwrap-ok-or.d.mts.map +0 -1
  290. package/dist/functional/result/impl/result-unwrap-ok-or.mjs +0 -17
  291. package/dist/functional/result/impl/result-unwrap-ok-or.mjs.map +0 -1
  292. package/dist/functional/result/impl/result-unwrap-ok.d.mts +0 -26
  293. package/dist/functional/result/impl/result-unwrap-ok.d.mts.map +0 -1
  294. package/dist/functional/result/impl/result-unwrap-ok.mjs +0 -8
  295. package/dist/functional/result/impl/result-unwrap-ok.mjs.map +0 -1
  296. package/dist/functional/result/impl/result-unwrap-throw.d.mts +0 -33
  297. package/dist/functional/result/impl/result-unwrap-throw.d.mts.map +0 -1
  298. package/dist/functional/result/impl/result-unwrap-throw.mjs +0 -40
  299. package/dist/functional/result/impl/result-unwrap-throw.mjs.map +0 -1
  300. package/dist/functional/result/impl/result-zip.d.mts +0 -32
  301. package/dist/functional/result/impl/result-zip.d.mts.map +0 -1
  302. package/dist/functional/result/impl/result-zip.mjs +0 -37
  303. package/dist/functional/result/impl/result-zip.mjs.map +0 -1
  304. package/dist/functional/result/impl/tag.d.mts +0 -6
  305. package/dist/functional/result/impl/tag.d.mts.map +0 -1
  306. package/dist/functional/result/impl/tag.mjs +0 -4
  307. package/dist/functional/result/impl/tag.mjs.map +0 -1
  308. package/dist/functional/result/impl/types.d.mts +0 -31
  309. package/dist/functional/result/impl/types.d.mts.map +0 -1
  310. package/dist/functional/result/impl/types.mjs +0 -2
  311. package/dist/functional/result/impl/types.mjs.map +0 -1
  312. package/dist/functional/result/index.d.mts +0 -2
  313. package/dist/functional/result/index.d.mts.map +0 -1
  314. package/dist/functional/result/index.mjs +0 -2
  315. package/dist/functional/result/index.mjs.map +0 -1
  316. package/dist/functional/result/result.d.mts +0 -16
  317. package/dist/functional/result/result.d.mts.map +0 -1
  318. package/dist/functional/result/result.mjs +0 -2
  319. package/dist/functional/result/result.mjs.map +0 -1
  320. package/dist/functional/ternary-result/impl/index.d.mts +0 -29
  321. package/dist/functional/ternary-result/impl/index.d.mts.map +0 -1
  322. package/dist/functional/ternary-result/impl/index.mjs +0 -29
  323. package/dist/functional/ternary-result/impl/index.mjs.map +0 -1
  324. package/dist/functional/ternary-result/impl/tag.d.mts +0 -8
  325. package/dist/functional/ternary-result/impl/tag.d.mts.map +0 -1
  326. package/dist/functional/ternary-result/impl/tag.mjs +0 -6
  327. package/dist/functional/ternary-result/impl/tag.mjs.map +0 -1
  328. package/dist/functional/ternary-result/impl/ternary-result-err.d.mts +0 -16
  329. package/dist/functional/ternary-result/impl/ternary-result-err.d.mts.map +0 -1
  330. package/dist/functional/ternary-result/impl/ternary-result-err.mjs +0 -19
  331. package/dist/functional/ternary-result/impl/ternary-result-err.mjs.map +0 -1
  332. package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.d.mts +0 -24
  333. package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.d.mts.map +0 -1
  334. package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.mjs +0 -21
  335. package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.mjs.map +0 -1
  336. package/dist/functional/ternary-result/impl/ternary-result-flat-map.d.mts +0 -39
  337. package/dist/functional/ternary-result/impl/ternary-result-flat-map.d.mts.map +0 -1
  338. package/dist/functional/ternary-result/impl/ternary-result-flat-map.mjs +0 -38
  339. package/dist/functional/ternary-result/impl/ternary-result-flat-map.mjs.map +0 -1
  340. package/dist/functional/ternary-result/impl/ternary-result-fold.d.mts +0 -30
  341. package/dist/functional/ternary-result/impl/ternary-result-fold.d.mts.map +0 -1
  342. package/dist/functional/ternary-result/impl/ternary-result-fold.mjs +0 -33
  343. package/dist/functional/ternary-result/impl/ternary-result-fold.mjs.map +0 -1
  344. package/dist/functional/ternary-result/impl/ternary-result-from-promise.d.mts +0 -23
  345. package/dist/functional/ternary-result/impl/ternary-result-from-promise.d.mts.map +0 -1
  346. package/dist/functional/ternary-result/impl/ternary-result-from-promise.mjs +0 -23
  347. package/dist/functional/ternary-result/impl/ternary-result-from-promise.mjs.map +0 -1
  348. package/dist/functional/ternary-result/impl/ternary-result-from-throwable.d.mts +0 -20
  349. package/dist/functional/ternary-result/impl/ternary-result-from-throwable.d.mts.map +0 -1
  350. package/dist/functional/ternary-result/impl/ternary-result-from-throwable.mjs +0 -33
  351. package/dist/functional/ternary-result/impl/ternary-result-from-throwable.mjs.map +0 -1
  352. package/dist/functional/ternary-result/impl/ternary-result-is-err.d.mts +0 -21
  353. package/dist/functional/ternary-result/impl/ternary-result-is-err.d.mts.map +0 -1
  354. package/dist/functional/ternary-result/impl/ternary-result-is-err.mjs +0 -20
  355. package/dist/functional/ternary-result/impl/ternary-result-is-err.mjs.map +0 -1
  356. package/dist/functional/ternary-result/impl/ternary-result-is-ok.d.mts +0 -23
  357. package/dist/functional/ternary-result/impl/ternary-result-is-ok.d.mts.map +0 -1
  358. package/dist/functional/ternary-result/impl/ternary-result-is-ok.mjs +0 -22
  359. package/dist/functional/ternary-result/impl/ternary-result-is-ok.mjs.map +0 -1
  360. package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.d.mts +0 -22
  361. package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.d.mts.map +0 -1
  362. package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.mjs +0 -28
  363. package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.mjs.map +0 -1
  364. package/dist/functional/ternary-result/impl/ternary-result-is-warn.d.mts +0 -22
  365. package/dist/functional/ternary-result/impl/ternary-result-is-warn.d.mts.map +0 -1
  366. package/dist/functional/ternary-result/impl/ternary-result-is-warn.mjs +0 -21
  367. package/dist/functional/ternary-result/impl/ternary-result-is-warn.mjs.map +0 -1
  368. package/dist/functional/ternary-result/impl/ternary-result-map-err.d.mts +0 -27
  369. package/dist/functional/ternary-result/impl/ternary-result-map-err.d.mts.map +0 -1
  370. package/dist/functional/ternary-result/impl/ternary-result-map-err.mjs +0 -23
  371. package/dist/functional/ternary-result/impl/ternary-result-map-err.mjs.map +0 -1
  372. package/dist/functional/ternary-result/impl/ternary-result-map-warn.d.mts +0 -28
  373. package/dist/functional/ternary-result/impl/ternary-result-map-warn.d.mts.map +0 -1
  374. package/dist/functional/ternary-result/impl/ternary-result-map-warn.mjs +0 -26
  375. package/dist/functional/ternary-result/impl/ternary-result-map-warn.mjs.map +0 -1
  376. package/dist/functional/ternary-result/impl/ternary-result-map.d.mts +0 -36
  377. package/dist/functional/ternary-result/impl/ternary-result-map.d.mts.map +0 -1
  378. package/dist/functional/ternary-result/impl/ternary-result-map.mjs +0 -32
  379. package/dist/functional/ternary-result/impl/ternary-result-map.mjs.map +0 -1
  380. package/dist/functional/ternary-result/impl/ternary-result-ok.d.mts +0 -17
  381. package/dist/functional/ternary-result/impl/ternary-result-ok.d.mts.map +0 -1
  382. package/dist/functional/ternary-result/impl/ternary-result-ok.mjs +0 -20
  383. package/dist/functional/ternary-result/impl/ternary-result-ok.mjs.map +0 -1
  384. package/dist/functional/ternary-result/impl/ternary-result-or-else.d.mts +0 -29
  385. package/dist/functional/ternary-result/impl/ternary-result-or-else.d.mts.map +0 -1
  386. package/dist/functional/ternary-result/impl/ternary-result-or-else.mjs +0 -16
  387. package/dist/functional/ternary-result/impl/ternary-result-or-else.mjs.map +0 -1
  388. package/dist/functional/ternary-result/impl/ternary-result-to-optional.d.mts +0 -23
  389. package/dist/functional/ternary-result/impl/ternary-result-to-optional.d.mts.map +0 -1
  390. package/dist/functional/ternary-result/impl/ternary-result-to-optional.mjs +0 -26
  391. package/dist/functional/ternary-result/impl/ternary-result-to-optional.mjs.map +0 -1
  392. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.d.mts +0 -28
  393. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.d.mts.map +0 -1
  394. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.mjs +0 -14
  395. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.mjs.map +0 -1
  396. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.d.mts +0 -20
  397. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.d.mts.map +0 -1
  398. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mjs +0 -34
  399. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mjs.map +0 -1
  400. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.d.mts +0 -20
  401. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.d.mts.map +0 -1
  402. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.mjs +0 -21
  403. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.mjs.map +0 -1
  404. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.d.mts +0 -25
  405. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.d.mts.map +0 -1
  406. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mjs +0 -14
  407. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mjs.map +0 -1
  408. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.d.mts +0 -20
  409. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.d.mts.map +0 -1
  410. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.mjs +0 -10
  411. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.mjs.map +0 -1
  412. package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.d.mts +0 -21
  413. package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.d.mts.map +0 -1
  414. package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.mjs +0 -35
  415. package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.mjs.map +0 -1
  416. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.d.mts +0 -22
  417. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.d.mts.map +0 -1
  418. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mjs +0 -14
  419. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mjs.map +0 -1
  420. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.d.mts +0 -20
  421. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.d.mts.map +0 -1
  422. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mjs +0 -30
  423. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mjs.map +0 -1
  424. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.d.mts +0 -20
  425. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.d.mts.map +0 -1
  426. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.mjs +0 -21
  427. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.mjs.map +0 -1
  428. package/dist/functional/ternary-result/impl/ternary-result-warn.d.mts +0 -19
  429. package/dist/functional/ternary-result/impl/ternary-result-warn.d.mts.map +0 -1
  430. package/dist/functional/ternary-result/impl/ternary-result-warn.mjs +0 -23
  431. package/dist/functional/ternary-result/impl/ternary-result-warn.mjs.map +0 -1
  432. package/dist/functional/ternary-result/impl/ternary-result-zip.d.mts +0 -34
  433. package/dist/functional/ternary-result/impl/ternary-result-zip.d.mts.map +0 -1
  434. package/dist/functional/ternary-result/impl/ternary-result-zip.mjs +0 -52
  435. package/dist/functional/ternary-result/impl/ternary-result-zip.mjs.map +0 -1
  436. package/dist/functional/ternary-result/impl/types.d.mts +0 -26
  437. package/dist/functional/ternary-result/impl/types.d.mts.map +0 -1
  438. package/dist/functional/ternary-result/impl/types.mjs +0 -2
  439. package/dist/functional/ternary-result/impl/types.mjs.map +0 -1
  440. package/dist/functional/ternary-result/impl/variant-name.d.mts +0 -4
  441. package/dist/functional/ternary-result/impl/variant-name.d.mts.map +0 -1
  442. package/dist/functional/ternary-result/impl/variant-name.mjs +0 -13
  443. package/dist/functional/ternary-result/impl/variant-name.mjs.map +0 -1
  444. package/dist/functional/ternary-result/index.d.mts +0 -2
  445. package/dist/functional/ternary-result/index.d.mts.map +0 -1
  446. package/dist/functional/ternary-result/index.mjs +0 -2
  447. package/dist/functional/ternary-result/index.mjs.map +0 -1
  448. package/dist/functional/ternary-result/ternary-result.d.mts +0 -40
  449. package/dist/functional/ternary-result/ternary-result.d.mts.map +0 -1
  450. package/dist/functional/ternary-result/ternary-result.mjs +0 -2
  451. package/dist/functional/ternary-result/ternary-result.mjs.map +0 -1
  452. package/src/functional/async-result/async-result.mts +0 -17
  453. package/src/functional/async-result/impl/async-result-flat-map.mts +0 -99
  454. package/src/functional/async-result/impl/async-result-from-promise.mts +0 -69
  455. package/src/functional/async-result/impl/async-result-from-throwable.mts +0 -78
  456. package/src/functional/async-result/impl/async-result-map-err.mts +0 -84
  457. package/src/functional/async-result/impl/async-result-map.mts +0 -94
  458. package/src/functional/async-result/impl/async-result-unwrap-or.mts +0 -42
  459. package/src/functional/async-result/impl/index.mts +0 -7
  460. package/src/functional/async-result/impl/types.mts +0 -51
  461. package/src/functional/async-result/index.mts +0 -1
  462. package/src/functional/async-result.test.mts +0 -291
  463. package/src/functional/match.mts +0 -193
  464. package/src/functional/match.test.mts +0 -180
  465. package/src/functional/optional/impl/index.mts +0 -18
  466. package/src/functional/optional/impl/optional-expect-to-be.mts +0 -75
  467. package/src/functional/optional/impl/optional-filter.mts +0 -78
  468. package/src/functional/optional/impl/optional-flat-map.mts +0 -75
  469. package/src/functional/optional/impl/optional-from-nullable.mts +0 -31
  470. package/src/functional/optional/impl/optional-is-none.mts +0 -26
  471. package/src/functional/optional/impl/optional-is-optional.mts +0 -30
  472. package/src/functional/optional/impl/optional-is-some.mts +0 -27
  473. package/src/functional/optional/impl/optional-map.mts +0 -90
  474. package/src/functional/optional/impl/optional-match.mts +0 -108
  475. package/src/functional/optional/impl/optional-none.mts +0 -20
  476. package/src/functional/optional/impl/optional-or-else.mts +0 -83
  477. package/src/functional/optional/impl/optional-some.mts +0 -27
  478. package/src/functional/optional/impl/optional-to-nullable.mts +0 -34
  479. package/src/functional/optional/impl/optional-unwrap-or.mts +0 -70
  480. package/src/functional/optional/impl/optional-unwrap-throw.mts +0 -41
  481. package/src/functional/optional/impl/optional-unwrap.mts +0 -45
  482. package/src/functional/optional/impl/optional-zip.mts +0 -44
  483. package/src/functional/optional/impl/tag.mts +0 -8
  484. package/src/functional/optional/impl/types.mts +0 -31
  485. package/src/functional/optional/index.mts +0 -1
  486. package/src/functional/optional/optional.mts +0 -19
  487. package/src/functional/optional.test.mts +0 -883
  488. package/src/functional/pipe.mts +0 -180
  489. package/src/functional/pipe.test.mts +0 -155
  490. package/src/functional/result/impl/index.mts +0 -27
  491. package/src/functional/result/impl/result-err.mts +0 -33
  492. package/src/functional/result/impl/result-expect-to-be.mts +0 -73
  493. package/src/functional/result/impl/result-flat-map.mts +0 -88
  494. package/src/functional/result/impl/result-fold.mts +0 -102
  495. package/src/functional/result/impl/result-from-optional.mts +0 -80
  496. package/src/functional/result/impl/result-from-promise.mts +0 -51
  497. package/src/functional/result/impl/result-from-throwable.mts +0 -48
  498. package/src/functional/result/impl/result-is-err.mts +0 -26
  499. package/src/functional/result/impl/result-is-ok.mts +0 -26
  500. package/src/functional/result/impl/result-is-result.mts +0 -28
  501. package/src/functional/result/impl/result-map-err.mts +0 -96
  502. package/src/functional/result/impl/result-map.mts +0 -96
  503. package/src/functional/result/impl/result-match.mts +0 -108
  504. package/src/functional/result/impl/result-ok.mts +0 -33
  505. package/src/functional/result/impl/result-or-else.mts +0 -73
  506. package/src/functional/result/impl/result-safe-try.mts +0 -110
  507. package/src/functional/result/impl/result-safe-unwrap.mts +0 -50
  508. package/src/functional/result/impl/result-swap.mts +0 -31
  509. package/src/functional/result/impl/result-to-optional.mts +0 -37
  510. package/src/functional/result/impl/result-unwrap-err-or.mts +0 -66
  511. package/src/functional/result/impl/result-unwrap-err-throw.mts +0 -56
  512. package/src/functional/result/impl/result-unwrap-err.mts +0 -38
  513. package/src/functional/result/impl/result-unwrap-ok-or.mts +0 -66
  514. package/src/functional/result/impl/result-unwrap-ok.mts +0 -39
  515. package/src/functional/result/impl/result-unwrap-throw.mts +0 -46
  516. package/src/functional/result/impl/result-zip.mts +0 -42
  517. package/src/functional/result/impl/tag.mts +0 -8
  518. package/src/functional/result/impl/types.mts +0 -38
  519. package/src/functional/result/index.mts +0 -1
  520. package/src/functional/result/result.mts +0 -19
  521. package/src/functional/result.test.mts +0 -1349
  522. package/src/functional/ternary-result/impl/index.mts +0 -28
  523. package/src/functional/ternary-result/impl/tag.mts +0 -17
  524. package/src/functional/ternary-result/impl/ternary-result-err.mts +0 -21
  525. package/src/functional/ternary-result/impl/ternary-result-expect-to-be.mts +0 -65
  526. package/src/functional/ternary-result/impl/ternary-result-flat-map.mts +0 -112
  527. package/src/functional/ternary-result/impl/ternary-result-fold.mts +0 -102
  528. package/src/functional/ternary-result/impl/ternary-result-from-promise.mts +0 -30
  529. package/src/functional/ternary-result/impl/ternary-result-from-throwable.mts +0 -36
  530. package/src/functional/ternary-result/impl/ternary-result-is-err.mts +0 -24
  531. package/src/functional/ternary-result/impl/ternary-result-is-ok.mts +0 -26
  532. package/src/functional/ternary-result/impl/ternary-result-is-ternary-result.mts +0 -32
  533. package/src/functional/ternary-result/impl/ternary-result-is-warn.mts +0 -25
  534. package/src/functional/ternary-result/impl/ternary-result-map-err.mts +0 -74
  535. package/src/functional/ternary-result/impl/ternary-result-map-warn.mts +0 -79
  536. package/src/functional/ternary-result/impl/ternary-result-map.mts +0 -95
  537. package/src/functional/ternary-result/impl/ternary-result-ok.mts +0 -22
  538. package/src/functional/ternary-result/impl/ternary-result-or-else.mts +0 -72
  539. package/src/functional/ternary-result/impl/ternary-result-to-optional.mts +0 -31
  540. package/src/functional/ternary-result/impl/ternary-result-unwrap-err-or.mts +0 -54
  541. package/src/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mts +0 -42
  542. package/src/functional/ternary-result/impl/ternary-result-unwrap-err.mts +0 -25
  543. package/src/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mts +0 -51
  544. package/src/functional/ternary-result/impl/ternary-result-unwrap-ok.mts +0 -39
  545. package/src/functional/ternary-result/impl/ternary-result-unwrap-throw.mts +0 -48
  546. package/src/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mts +0 -48
  547. package/src/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mts +0 -40
  548. package/src/functional/ternary-result/impl/ternary-result-unwrap-warn.mts +0 -25
  549. package/src/functional/ternary-result/impl/ternary-result-warn.mts +0 -28
  550. package/src/functional/ternary-result/impl/ternary-result-zip.mts +0 -61
  551. package/src/functional/ternary-result/impl/types.mts +0 -46
  552. package/src/functional/ternary-result/impl/variant-name.mts +0 -18
  553. package/src/functional/ternary-result/index.mts +0 -1
  554. package/src/functional/ternary-result/ternary-result.mts +0 -50
  555. package/src/functional/ternary-result.test.mts +0 -310
  556. package/src/guard/has-key.test.mts +0 -111
  557. package/src/guard/is-non-null-object.test.mts +0 -109
  558. package/src/guard/is-record.test.mts +0 -195
  559. package/src/guard/key-is-in.test.mts +0 -21
  560. package/src/others/unknown-to-string.test.mts +0 -295
@@ -1,102 +0,0 @@
1
- import { Optional, type UnknownOptional } from './optional/index.mjs';
2
- /**
3
- * Creates a new pipe object that allows for chaining operations on a value.
4
- *
5
- * This function provides a fluent interface for applying transformations to
6
- * values, with intelligent method selection based on the input type:
7
- *
8
- * - For `Optional` values: Provides `mapOptional` for safe Optional
9
- * transformations
10
- * - For other values: Provides `mapNullable` for null-safe transformations
11
- * - All types get the basic `map` method for general transformations
12
- *
13
- * The pipe maintains type safety throughout the chain, automatically selecting
14
- * the appropriate overload based on the current value type.
15
- *
16
- * @template A The type of the initial value to wrap in a pipe.
17
- * @param a The initial value to wrap in a pipe.
18
- * @returns A pipe object with chaining methods appropriate for the value type.
19
- */
20
- export declare const pipe: <const A>(a: A) => Pipe<A>;
21
- export type Pipe<A> = PipeBase<A> & PipeMapNullable<A> & ([A] extends [UnknownOptional] ? PipeMapOptional<A> : unknown);
22
- type PipeBase<A> = Readonly<{
23
- /** The current value being piped. */
24
- value: A;
25
- /**
26
- * Maps the current value to a new value using the provided function.
27
- *
28
- * @example
29
- *
30
- * ```ts
31
- * const result = pipe(2)
32
- * .map((value) => value * 3)
33
- * .map((value) => `value: ${value}`);
34
- *
35
- * assert.deepStrictEqual(result.value, 'value: 6');
36
- * ```
37
- *
38
- * @template B The type of the new value.
39
- * @param fn Function to transform the current value.
40
- * @returns A new pipe containing the transformed value.
41
- */
42
- map: <B>(fn: (a: A) => B) => Pipe<B>;
43
- }>;
44
- type PipeMapNullable<A> = Readonly<{
45
- /**
46
- * Maps the current value only if it's not null or undefined. If the current
47
- * value is null/undefined, the transformation is skipped and undefined is
48
- * propagated through the pipe.
49
- *
50
- * @example
51
- *
52
- * ```ts
53
- * const result = pipe<string | undefined>('hello')
54
- * .mapNullable((value) => value.toUpperCase())
55
- * .mapNullable((value) => value.slice(0, 2));
56
- *
57
- * assert.deepStrictEqual(result.value, 'HE');
58
- *
59
- * const empty = pipe<string | undefined>(undefined).mapNullable((value) =>
60
- * value.toUpperCase(),
61
- * );
62
- *
63
- * assert.isTrue(empty.value === undefined);
64
- * ```
65
- *
66
- * @template B The type of the transformed value.
67
- * @param fn Function to transform the non-null value.
68
- * @returns A new pipe containing the transformed value or undefined.
69
- */
70
- mapNullable: <B>(fn: (a: NonNullable<A>) => B) => Pipe<B | undefined>;
71
- }>;
72
- type PipeMapOptional<A extends UnknownOptional> = Readonly<{
73
- /**
74
- * Maps the value inside an Optional using Optional.map semantics. If the
75
- * Optional is None, the transformation is skipped and None is propagated.
76
- * If the Optional is Some, the transformation is applied to the inner
77
- * value.
78
- *
79
- * @example
80
- *
81
- * ```ts
82
- * const result = pipe(Optional.some(10))
83
- * .mapOptional((value) => value * 2)
84
- * .mapOptional((value) => value + 5);
85
- *
86
- * assert.deepStrictEqual(result.value, Optional.some(25));
87
- *
88
- * const empty = pipe(Optional.none as Optional<number>).mapOptional(
89
- * (value) => value * 2,
90
- * );
91
- *
92
- * assert.isTrue(Optional.isNone(empty.value));
93
- * ```
94
- *
95
- * @template B The type of the transformed inner value.
96
- * @param fn Function to transform the inner value of the Optional.
97
- * @returns A new pipe containing an Optional with the transformed value.
98
- */
99
- mapOptional: <B>(fn: (a: Optional.Unwrap<A>) => B) => Pipe<Optional<B>>;
100
- }>;
101
- export {};
102
- //# sourceMappingURL=pipe.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pipe.d.mts","sourceRoot":"","sources":["../../src/functional/pipe.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEtE;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,IAAI,GAAI,KAAK,CAAC,CAAC,KAAM,CAAC,KAAG,IAAI,CAAC,CAAC,CAYI,CAAC;AAkBjD,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,GAC/B,eAAe,CAAC,CAAC,CAAC,GAClB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC;AAgCjE,KAAK,QAAQ,CAAC,CAAC,IAAI,QAAQ,CAAC;IAC1B,qCAAqC;IACrC,KAAK,EAAE,CAAC,CAAC;IAET;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC;CACtC,CAAC,CAAC;AAEH,KAAK,eAAe,CAAC,CAAC,IAAI,QAAQ,CAAC;IACjC;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;CACvE,CAAC,CAAC;AAEH,KAAK,eAAe,CAAC,CAAC,SAAS,eAAe,IAAI,QAAQ,CAAC;IACzD;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;CACzE,CAAC,CAAC"}
@@ -1,45 +0,0 @@
1
-
2
- import { Optional } from './optional/index.mjs';
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
- export const pipe = (a) =>
22
-
23
- ({
24
- value: a,
25
- map: (fn) => pipe(fn(a)),
26
- mapNullable: (fn) => pipe(a == null ? undefined : fn(a)),
27
- ...(Optional.isOptional(a)
28
- ? {
29
- mapOptional: (fn) => pipe(Optional.map(a, fn)),
30
- }
31
- : {}),
32
- });
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
- //# sourceMappingURL=pipe.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pipe.mjs","sourceRoot":"","sources":["../../src/functional/pipe.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAwB,MAAM,sBAAsB,CAAC;AAEtE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAW,CAAI,EAAW,EAAE;AAC9C,oEAAoE;AACpE,CAAC;IACC,KAAK,EAAE,CAAC;IACR,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACxB,WAAW,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAExD,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;QACxB,CAAC,CAAC;YACE,WAAW,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;SAC/C;QACH,CAAC,CAAC,EAAE,CAAC;CACR,CAA6C,CAAC;AAsBjD,6DAA6D;AAC7D,gFAAgF;AAChF,sCAAsC;AACtC,qEAAqE;AACrE,+DAA+D;AAC/D,yDAAyD;AAEzD,UAAU,CAAoC,IAAI,CAAC,CAAC;AAEpD,UAAU,CAAgC,IAAI,CAAC,CAAC;AAEhD,UAAU,CACR,GAAG,CACJ,CAAC;AAEF,UAAU,CAGR,GAAG,CAAC,CAAC;AAEP,UAAU,CAGR,GAAG,CAAC,CAAC;AAEP,UAAU,CAGR,GAAG,CAAC,CAAC"}
@@ -1,28 +0,0 @@
1
- export * from './result-err.mjs';
2
- export * from './result-expect-to-be.mjs';
3
- export * from './result-flat-map.mjs';
4
- export * from './result-fold.mjs';
5
- export * from './result-from-optional.mjs';
6
- export * from './result-from-promise.mjs';
7
- export * from './result-from-throwable.mjs';
8
- export * from './result-is-err.mjs';
9
- export * from './result-is-ok.mjs';
10
- export * from './result-is-result.mjs';
11
- export * from './result-map-err.mjs';
12
- export * from './result-map.mjs';
13
- export * from './result-match.mjs';
14
- export * from './result-ok.mjs';
15
- export * from './result-or-else.mjs';
16
- export * from './result-safe-try.mjs';
17
- export * from './result-safe-unwrap.mjs';
18
- export * from './result-swap.mjs';
19
- export * from './result-to-optional.mjs';
20
- export * from './result-unwrap-err-or.mjs';
21
- export * from './result-unwrap-err-throw.mjs';
22
- export * from './result-unwrap-err.mjs';
23
- export * from './result-unwrap-ok-or.mjs';
24
- export * from './result-unwrap-ok.mjs';
25
- export * from './result-unwrap-throw.mjs';
26
- export * from './result-zip.mjs';
27
- export * from './types.mjs';
28
- //# sourceMappingURL=index.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/index.mts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC"}
@@ -1,28 +0,0 @@
1
- export * from './result-err.mjs';
2
- export * from './result-expect-to-be.mjs';
3
- export * from './result-flat-map.mjs';
4
- export * from './result-fold.mjs';
5
- export * from './result-from-optional.mjs';
6
- export * from './result-from-promise.mjs';
7
- export * from './result-from-throwable.mjs';
8
- export * from './result-is-err.mjs';
9
- export * from './result-is-ok.mjs';
10
- export * from './result-is-result.mjs';
11
- export * from './result-map-err.mjs';
12
- export * from './result-map.mjs';
13
- export * from './result-match.mjs';
14
- export * from './result-ok.mjs';
15
- export * from './result-or-else.mjs';
16
- export * from './result-safe-try.mjs';
17
- export * from './result-safe-unwrap.mjs';
18
- export * from './result-swap.mjs';
19
- export * from './result-to-optional.mjs';
20
- export * from './result-unwrap-err-or.mjs';
21
- export * from './result-unwrap-err-throw.mjs';
22
- export * from './result-unwrap-err.mjs';
23
- export * from './result-unwrap-ok-or.mjs';
24
- export * from './result-unwrap-ok.mjs';
25
- export * from './result-unwrap-throw.mjs';
26
- export * from './result-zip.mjs';
27
- export * from './types.mjs';
28
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/index.mts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC"}
@@ -1,28 +0,0 @@
1
- import { type Err } from '../../../types.mjs';
2
- /**
3
- * Creates a `Result.Err` containing the given error value.
4
- *
5
- * Use this constructor when an operation fails and you want to wrap the error
6
- * information in a Result type for consistent error handling.
7
- *
8
- * @example
9
- *
10
- * ```ts
11
- * const success = Result.ok({ id: 1 });
12
- *
13
- * const failure = Result.err(new Error('missing data'));
14
- *
15
- * assert.deepStrictEqual(success, {
16
- * $$tag: 'ts-data-forge::Result.ok',
17
- * value: { id: 1 },
18
- * });
19
- *
20
- * assert.isTrue(Result.isErr(failure));
21
- * ```
22
- *
23
- * @template E The type of the error value.
24
- * @param value The error value.
25
- * @returns A `Result.Err<E>` containing the value.
26
- */
27
- export declare const err: <const E>(value: E) => Err<E>;
28
- //# sourceMappingURL=result-err.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-err.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-err.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAG9C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,GAAG,GAAI,KAAK,CAAC,CAAC,SAAU,CAAC,KAAG,GAAG,CAAC,CAAC,CAIjC,CAAC"}
@@ -1,31 +0,0 @@
1
- import { ErrTypeTagName } from './tag.mjs';
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
- export const err = (value) => ({
28
- $$tag: ErrTypeTagName,
29
- value,
30
- });
31
- //# sourceMappingURL=result-err.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-err.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-err.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,CAAW,KAAQ,EAAU,EAAE,CAChD,CAAC;IACC,KAAK,EAAE,cAAc;IACrB,KAAK;CACN,CAAU,CAAC"}
@@ -1,33 +0,0 @@
1
- import { type UnknownResult } from '../result.mjs';
2
- import { type UnwrapOk } from './types.mjs';
3
- /**
4
- * Unwraps a `Result`, returning the success value or throwing an error with
5
- * the provided message.
6
- *
7
- * @example
8
- *
9
- * ```ts
10
- * const okValue = Result.ok('data');
11
- *
12
- * assert.isTrue(Result.expectToBe(okValue, 'should have value') === 'data');
13
- *
14
- * const expectResult = Result.expectToBe('missing result');
15
- *
16
- * const throwTest = (): void => {
17
- * expectResult(Result.err('boom'));
18
- * };
19
- *
20
- * assert.throws(throwTest, /missing result/u);
21
- *
22
- * assert.isTrue(expectResult(Result.ok('value')) === 'value');
23
- * ```
24
- *
25
- * @template R The `UnknownResult` type to unwrap.
26
- * @param result The `Result` to unwrap.
27
- * @param message The error message to throw if the `Result` is `Result.Err`.
28
- * @returns The success value if `Result.Ok`.
29
- * @throws Error with the provided message if the `Result` is `Result.Err`.
30
- */
31
- export declare function expectToBe<R extends UnknownResult>(result: R, message: string): UnwrapOk<R>;
32
- export declare function expectToBe(message: string): <R extends UnknownResult>(result: R) => UnwrapOk<R>;
33
- //# sourceMappingURL=result-expect-to-be.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-expect-to-be.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-expect-to-be.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,aAAa,EAChD,MAAM,EAAE,CAAC,EACT,OAAO,EAAE,MAAM,GACd,QAAQ,CAAC,CAAC,CAAC,CAAC;AAGf,wBAAgB,UAAU,CACxB,OAAO,EAAE,MAAM,GACd,CAAC,CAAC,SAAS,aAAa,EAAE,MAAM,EAAE,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC"}
@@ -1,23 +0,0 @@
1
- import { isOk } from './result-is-ok.mjs';
2
- import { unwrapOk } from './result-unwrap-ok.mjs';
3
- export function expectToBe(...args) {
4
- switch (args.length) {
5
- case 2: {
6
-
7
- const [result, message] = args;
8
- return expectToBeImpl(result, message);
9
- }
10
- case 1: {
11
-
12
- const [message] = args;
13
- return (result) => expectToBeImpl(result, message);
14
- }
15
- }
16
- }
17
- const expectToBeImpl = (result, message) => {
18
- if (isOk(result)) {
19
- return unwrapOk(result);
20
- }
21
- throw new Error(message);
22
- };
23
- //# sourceMappingURL=result-expect-to-be.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-expect-to-be.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-expect-to-be.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAyClD,MAAM,UAAU,UAAU,CACxB,GAAG,IAAwE;IAE3E,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,CAAC,EAAE,CAAC;YACP,2CAA2C;YAC3C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;YAE/B,OAAO,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACzC,CAAC;QAED,KAAK,CAAC,EAAE,CAAC;YACP,6CAA6C;YAC7C,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;YAEvB,OAAO,CAAC,MAAS,EAAe,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,cAAc,GAAG,CACrB,MAAS,EACT,OAAe,EACF,EAAE;IACf,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACjB,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC,CAAC"}
@@ -1,45 +0,0 @@
1
- import { type Result, type UnknownResult } from '../result.mjs';
2
- import { type UnwrapErr, type UnwrapOk } from './types.mjs';
3
- /**
4
- * Applies a function that returns a `Result` to the success value of a
5
- * `Result`. If the input is `Err`, returns the original `Err`. This is the
6
- * monadic bind operation for `Result`.
7
- *
8
- * @example
9
- *
10
- * ```ts
11
- * const parseNumber = (input: string): Result<number, string> => {
12
- * const num = Num.safeParseInt(input);
13
- *
14
- * return Result.mapErr(num, () => 'not a number');
15
- * };
16
- *
17
- * const parsed = Result.flatMap(Result.ok('42'), parseNumber);
18
- *
19
- * const failure = Result.flatMap(Result.ok('abc'), parseNumber);
20
- *
21
- * const passthrough = Result.flatMap(Result.err('fail'), parseNumber);
22
- *
23
- * assert.deepStrictEqual(parsed, Result.ok(42));
24
- *
25
- * assert.deepStrictEqual(failure, Result.err('not a number'));
26
- *
27
- * assert.deepStrictEqual(passthrough, Result.err('fail'));
28
- *
29
- * const parseThenDouble = Result.flatMap((input: string) =>
30
- * Result.map(parseNumber(input), (value) => value * 2),
31
- * );
32
- *
33
- * assert.deepStrictEqual(parseThenDouble(Result.ok('10')), Result.ok(20));
34
- * ```
35
- *
36
- * @template R The input `UnknownResult` type.
37
- * @template S2 The success type of the `Result` returned by the function.
38
- * @template E2 The error type of the `Result` returned by the function.
39
- * @param result The `Result` to flat map.
40
- * @param flatMapFn The function to apply that returns a `Result`.
41
- * @returns The result of applying the function, or the original `Err`.
42
- */
43
- export declare function flatMap<R extends UnknownResult, S2, E2>(result: R, flatMapFn: (value: UnwrapOk<R>) => Result<S2, E2>): Result<S2, E2 | UnwrapErr<R>>;
44
- export declare function flatMap<S, S2, E2>(flatMapFn: (value: S) => Result<S2, E2>): <E>(result: Result<S, E>) => Result<S2, E | E2>;
45
- //# sourceMappingURL=result-flat-map.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-flat-map.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-flat-map.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEhE,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,aAAa,EAAE,EAAE,EAAE,EAAE,EACrD,MAAM,EAAE,CAAC,EACT,SAAS,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAChD,MAAM,CAAC,EAAE,EAAE,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAGjC,wBAAgB,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAC/B,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GACtC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC"}
@@ -1,21 +0,0 @@
1
- import { isErr } from './result-is-err.mjs';
2
- export function flatMap(...args) {
3
- switch (args.length) {
4
- case 2: {
5
-
6
- const [result, flatMapFn] = args;
7
- return flatMapImpl(result, flatMapFn);
8
- }
9
- case 1: {
10
-
11
- const [flatMapFn] = args;
12
- return (result) => flatMapImpl(result, flatMapFn);
13
- }
14
- }
15
- }
16
- const flatMapImpl = (result, flatMapFn) => isErr(result)
17
- ?
18
- result
19
- :
20
- flatMapFn(result.value);
21
- //# sourceMappingURL=result-flat-map.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-flat-map.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-flat-map.mts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAqD5C,MAAM,UAAU,OAAO,CACrB,GAAG,IAE6D;IAIhE,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,CAAC,EAAE,CAAC;YACP,2CAA2C;YAC3C,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC;YAEjC,OAAO,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QACxC,CAAC;QAED,KAAK,CAAC,EAAE,CAAC;YACP,kBAAkB;YAClB,MAAM,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;YAEzB,OAAO,CAAC,MAAS,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,WAAW,GAAG,CAClB,MAAS,EACT,SAAiD,EAClB,EAAE,CACjC,KAAK,CAAC,MAAM,CAAC;IACX,CAAC,CAAC,oEAAoE;QACnE,MAA4B;IAC/B,CAAC,CAAC,oEAAoE;QACpE,SAAS,CAAC,MAAM,CAAC,KAAoB,CAAC,CAAC"}
@@ -1,50 +0,0 @@
1
- import { type Result, type UnknownResult } from '../result.mjs';
2
- import { type UnwrapErr, type UnwrapOk } from './types.mjs';
3
- /**
4
- * Applies one of two functions depending on whether the `Result` is `Ok` or
5
- * `Err`.
6
- *
7
- * @example
8
- *
9
- * ```ts
10
- * const okValue = Result.ok(2);
11
- *
12
- * const errValue = Result.err('bad');
13
- *
14
- * const foldedOk = Result.fold(
15
- * okValue,
16
- * (value) => value * 2,
17
- * (error) => error,
18
- * );
19
- *
20
- * const foldedErr = Result.fold(
21
- * errValue,
22
- * (value: number) => value * 2,
23
- * (error) => error.toUpperCase(),
24
- * );
25
- *
26
- * assert.deepStrictEqual(foldedOk, Result.ok(4));
27
- *
28
- * assert.deepStrictEqual(foldedErr, Result.err('BAD'));
29
- *
30
- * const foldNumbers = Result.fold(
31
- * (value: number) => value * 3,
32
- * (error: string) => error.length,
33
- * );
34
- *
35
- * assert.deepStrictEqual(foldNumbers(Result.ok(3)), Result.ok(9));
36
- *
37
- * assert.deepStrictEqual(foldNumbers(Result.err('oops')), Result.err(4));
38
- * ```
39
- *
40
- * @template R The input `UnknownResult` type.
41
- * @template S2 The type of the success value returned by `mapFn`.
42
- * @template E2 The type of the error value returned by `mapErrFn`.
43
- * @param result The `Result` to fold.
44
- * @param mapFn The function to apply if `result` is `Ok`.
45
- * @param mapErrFn The function to apply if `result` is `Err`.
46
- * @returns A new `Result<S2, E2>` based on the applied function.
47
- */
48
- export declare function fold<R extends UnknownResult, S2, E2>(result: R, mapFn: (value: UnwrapOk<R>) => S2, mapErrFn: (error: UnwrapErr<R>) => E2): Result<S2, E2>;
49
- export declare function fold<S, E, S2, E2>(mapFn: (value: S) => S2, mapErrFn: (error: E) => E2): (result: Result<S, E>) => Result<S2, E2>;
50
- //# sourceMappingURL=result-fold.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-fold.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-fold.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAIhE,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,aAAa,EAAE,EAAE,EAAE,EAAE,EAClD,MAAM,EAAE,CAAC,EACT,KAAK,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,EAAE,EACjC,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,EAAE,GACpC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAGlB,wBAAgB,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAC/B,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,EACvB,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,GACzB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC"}
@@ -1,23 +0,0 @@
1
- import { err } from './result-err.mjs';
2
- import { isOk } from './result-is-ok.mjs';
3
- import { ok } from './result-ok.mjs';
4
- export function fold(...args) {
5
- switch (args.length) {
6
- case 3: {
7
-
8
- const [result, mapFn, mapErrFn] = args;
9
- return foldImpl(result, mapFn, mapErrFn);
10
- }
11
- case 2: {
12
-
13
- const [mapFn, mapErrFn] = args;
14
- return (result) => foldImpl(result, mapFn, mapErrFn);
15
- }
16
- }
17
- }
18
- const foldImpl = (result, mapFn, mapErrFn) => isOk(result)
19
- ?
20
- ok(mapFn(result.value))
21
- :
22
- err(mapErrFn(result.value));
23
- //# sourceMappingURL=result-fold.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-fold.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-fold.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AA4DrC,MAAM,UAAU,IAAI,CAClB,GAAG,IASE;IAEL,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,CAAC,EAAE,CAAC;YACP,2CAA2C;YAC3C,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC;YAEvC,OAAO,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC3C,CAAC;QAED,KAAK,CAAC,EAAE,CAAC;YACP,kBAAkB;YAClB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC;YAE/B,OAAO,CAAC,MAAS,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,QAAQ,GAAG,CACf,MAAS,EACT,KAAiC,EACjC,QAAqC,EACrB,EAAE,CAClB,IAAI,CAAC,MAAM,CAAC;IACV,CAAC,CAAC,oEAAoE;QACpE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,KAAoB,CAAC,CAAC;IACxC,CAAC,CAAC,oEAAoE;QACpE,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAqB,CAAC,CAAC,CAAC"}
@@ -1,41 +0,0 @@
1
- import { Optional, type UnknownOptional } from '../../optional/index.mjs';
2
- import { type Result } from '../result.mjs';
3
- /**
4
- * Converts an {@link Optional} to a `Result` (the inverse of
5
- * {@link Result.toOptional}, and the equivalent of Rust's `Option::ok_or`).
6
- *
7
- * If the {@link Optional} is `Some`, returns `Ok` with the contained value.
8
- * If it is `None`, returns `Err` with the provided error value.
9
- *
10
- * @example
11
- *
12
- * ```ts
13
- * assert.deepStrictEqual(
14
- * Result.fromOptional(Optional.some(42), 'missing'),
15
- * Result.ok(42),
16
- * );
17
- *
18
- * assert.deepStrictEqual(
19
- * Result.fromOptional(Optional.none, 'missing'),
20
- * Result.err('missing'),
21
- * );
22
- *
23
- * const withMissingError = Result.fromOptional('missing');
24
- *
25
- * assert.deepStrictEqual(withMissingError(Optional.some(1)), Result.ok(1));
26
- *
27
- * assert.deepStrictEqual(
28
- * withMissingError(Optional.none),
29
- * Result.err('missing'),
30
- * );
31
- * ```
32
- *
33
- * @template O The input `UnknownOptional` type.
34
- * @template E The type of the error value used for the `None` case.
35
- * @param optional The `Optional` to convert.
36
- * @param error The error value to use if the `Optional` is `None`.
37
- * @returns `Ok` with the contained value, or `Err` with `error`.
38
- */
39
- export declare function fromOptional<O extends UnknownOptional, const E>(optional: O, error: E): Result<Optional.Unwrap<O>, E>;
40
- export declare function fromOptional<const E>(error: E): <O extends UnknownOptional>(optional: O) => Result<Optional.Unwrap<O>, E>;
41
- //# sourceMappingURL=result-from-optional.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-from-optional.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-from-optional.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAI5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,eAAe,EAAE,KAAK,CAAC,CAAC,EAC7D,QAAQ,EAAE,CAAC,EACX,KAAK,EAAE,CAAC,GACP,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAGjC,wBAAgB,YAAY,CAAC,KAAK,CAAC,CAAC,EAClC,KAAK,EAAE,CAAC,GACP,CAAC,CAAC,SAAS,eAAe,EAAE,QAAQ,EAAE,CAAC,KAAK,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC"}
@@ -1,21 +0,0 @@
1
- import { Optional } from '../../optional/index.mjs';
2
- import { err } from './result-err.mjs';
3
- import { ok } from './result-ok.mjs';
4
- export function fromOptional(...args) {
5
- switch (args.length) {
6
- case 2: {
7
- const [optional, error] = args;
8
- return fromOptionalImpl(optional, error);
9
- }
10
- case 1: {
11
-
12
- const [error] = args;
13
- return (optional) => fromOptionalImpl(optional, error);
14
- }
15
- }
16
- }
17
- const fromOptionalImpl = (optional, error) => Optional.isSome(optional)
18
- ?
19
- ok(Optional.unwrap(optional))
20
- : err(error);
21
- //# sourceMappingURL=result-from-optional.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-from-optional.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-from-optional.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAwB,MAAM,0BAA0B,CAAC;AAE1E,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAgDrC,MAAM,UAAU,YAAY,CAC1B,GAAG,IAA4D;IAI/D,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,CAAC,EAAE,CAAC;YACP,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC;YAE/B,OAAO,gBAAgB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC3C,CAAC;QAED,KAAK,CAAC,EAAE,CAAC;YACP,wDAAwD;YACxD,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;YAErB,OAAO,CAAC,QAAW,EAAE,EAAE,CAAC,gBAAgB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,gBAAgB,GAAG,CACvB,QAAW,EACX,KAAQ,EACuB,EAAE,CACjC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC;IACvB,CAAC,CAAC,oEAAoE;QACpE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAE,CAAC;IAChC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC"}
@@ -1,43 +0,0 @@
1
- import { type Result } from '../result.mjs';
2
- /**
3
- * @template P The Promise type.
4
- * @internal
5
- * Utility type to extract the resolved value type from a Promise.
6
- */
7
- type UnwrapPromise<P extends Promise<unknown>> = P extends Promise<infer V> ? V : never;
8
- /**
9
- * Converts a Promise into a Promise that resolves to a `Result`. If the input
10
- * Promise resolves, the `Result` will be `Ok` with the resolved value. If the
11
- * input Promise rejects, the `Result` will be `Err` with the rejection
12
- * reason.
13
- *
14
- * The error channel is `unknown`, since the rejection reason is carried
15
- * through untouched. For a concrete error type, use `AsyncResult.fromPromise`
16
- * with a `mapError` function; called without one it behaves exactly as this
17
- * function does.
18
- *
19
- * @example
20
- *
21
- * ```ts
22
- * const successPromise = Result.fromPromise(Promise.resolve('ok'));
23
- *
24
- * const failurePromise = Result.fromPromise(
25
- * Promise.reject(new Error('fail')),
26
- * );
27
- *
28
- * const resolved = await successPromise;
29
- *
30
- * const rejected = await failurePromise;
31
- *
32
- * assert.deepStrictEqual(resolved, Result.ok('ok'));
33
- *
34
- * assert.isTrue(Result.isErr(rejected));
35
- * ```
36
- *
37
- * @template P The type of the input Promise.
38
- * @param promise The Promise to convert.
39
- * @returns A Promise that resolves to `Result<UnwrapPromise<P>, unknown>`.
40
- */
41
- export declare const fromPromise: <P extends Promise<unknown>>(promise: P) => Promise<Result<UnwrapPromise<P>, unknown>>;
42
- export {};
43
- //# sourceMappingURL=result-from-promise.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-from-promise.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-from-promise.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAI5C;;;;GAIG;AACH,KAAK,aAAa,CAAC,CAAC,SAAS,OAAO,CAAC,OAAO,CAAC,IAC3C,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,OAAO,CAAC,OAAO,CAAC,WAC3C,CAAC,KACT,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAEmB,CAAC"}