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 +0,0 @@
1
- {"version":3,"file":"result-or-else.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-or-else.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAgD1C,MAAM,UAAU,MAAM,CACpB,GAAG,IAAwE;IAE3E,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,CAAC,EAAE,CAAC;YACP,2CAA2C;YAC3C,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,IAAI,CAAC;YAEnC,OAAO,UAAU,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QACzC,CAAC;QAED,KAAK,CAAC,EAAE,CAAC;YACP,kBAAkB;YAClB,MAAM,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;YAE3B,OAAO,CAAC,MAAS,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,UAAU,GAAG,CACjB,MAAS,EACT,WAAe,EACK,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC"}
@@ -1,51 +0,0 @@
1
- import { type Err } from '../../../types.mjs';
2
- import { type Result, type UnknownResult } from '../result.mjs';
3
- import { type UnwrapErr, type UnwrapOk } from './types.mjs';
4
- /**
5
- * Runs a generator body in which `yield* Result.safeUnwrap(...)` unwraps `Ok`
6
- * values and short-circuits on the first `Err`, emulating Rust's `?` operator
7
- * (early-return error propagation).
8
- *
9
- * The body must return a `Result`. If every unwrapped `Result` is `Ok`, the
10
- * returned value is the body's `Result`; otherwise it is the first `Err`
11
- * encountered, and the rest of the body never runs — though the generator is
12
- * closed rather than dropped, so `finally` blocks and `using` disposals
13
- * pending in the body still run. An exception thrown by the body is not
14
- * converted to an `Err`: it propagates out of `safeTry` (as a rejected
15
- * `Promise` for an async body). Use {@link Result.fromThrowable} for that.
16
- *
17
- * Passing an async generator (`async function*`) returns a
18
- * `Promise<Result<...>>` instead, so `await` can be used inside the body.
19
- * Note that `yield*` inside an `async function*` awaits what it receives, so
20
- * unwrapping an `Ok` whose value is itself a `Promise` yields the awaited
21
- * value there while the static type still says `Promise<...>`; keep promises
22
- * out of the `Ok` side of a `Result` unwrapped in an async body.
23
- *
24
- * @example
25
- *
26
- * ```ts
27
- * const parseTwo = (a: string, b: string): Result<number, Error> =>
28
- * Result.safeTry(function* () {
29
- * const x = yield* Result.safeUnwrap(Num.safeParseInt(a));
30
- *
31
- * const y = yield* Result.safeUnwrap(Num.safeParseInt(b));
32
- *
33
- * return Result.ok(x + y);
34
- * });
35
- *
36
- * assert.deepStrictEqual(parseTwo('1', '2'), Result.ok(3));
37
- *
38
- * assert.isTrue(Result.isErr(parseTwo('1', 'not a number')));
39
- * ```
40
- *
41
- * @template Y The union of `Err` types unwrapped via
42
- * {@link Result.safeUnwrap} (`never` if nothing is unwrapped).
43
- * @template R2 The `Result` type returned by the body.
44
- * @param body A generator function whose `yield*` expressions delegate to
45
- * {@link Result.safeUnwrap} and whose return value is a `Result`.
46
- * @returns The body's `Result`, or the first `Err` short-circuited out of it
47
- * (wrapped in a `Promise` for an async generator body).
48
- */
49
- export declare function safeTry<Y extends Err<unknown>, R2 extends UnknownResult>(body: () => Generator<Y, R2>): Result<UnwrapOk<R2>, UnwrapErr<R2> | UnwrapErr<Y>>;
50
- export declare function safeTry<Y extends Err<unknown>, R2 extends UnknownResult>(body: () => AsyncGenerator<Y, R2>): Promise<Result<UnwrapOk<R2>, UnwrapErr<R2> | UnwrapErr<Y>>>;
51
- //# sourceMappingURL=result-safe-try.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-safe-try.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-safe-try.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,SAAS,aAAa,EACtE,IAAI,EAAE,MAAM,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,GAC3B,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAEtD,wBAAgB,OAAO,CAAC,CAAC,SAAS,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,SAAS,aAAa,EACtE,IAAI,EAAE,MAAM,cAAc,CAAC,CAAC,EAAE,EAAE,CAAC,GAChC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -1,35 +0,0 @@
1
- import { hasKey, isRecord } from '../../../guard/index.mjs';
2
- export function safeTry(body) {
3
- const generator = body();
4
-
5
-
6
-
7
- const step = generator.next();
8
- if (isSyncStep(step)) {
9
-
10
-
11
-
12
-
13
- if (step.done !== true && isSyncGenerator(generator, step)) {
14
- generator.return(step.value);
15
- }
16
- return step.value;
17
- }
18
- return step.then(async (asyncStep) => {
19
- if (asyncStep.done !== true) {
20
- await generator.return(asyncStep.value);
21
- }
22
- return asyncStep.value;
23
- });
24
- }
25
-
26
-
27
-
28
-
29
- const isSyncStep = (value) => isRecord(value) && hasKey(value, 'done');
30
-
31
-
32
-
33
-
34
- const isSyncGenerator = (_generator, step) => isSyncStep(step);
35
- //# sourceMappingURL=result-safe-try.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-safe-try.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-safe-try.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AA0D5D,MAAM,UAAU,OAAO,CACrB,IAEmD;IAEnD,MAAM,SAAS,GAAG,IAAI,EAAE,CAAC;IAEzB,qEAAqE;IACrE,wEAAwE;IACxE,0DAA0D;IAC1D,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;IAE9B,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACrB,qEAAqE;QACrE,oEAAoE;QACpE,wEAAwE;QACxE,yEAAyE;QACzE,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,IAAI,eAAe,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC;YAC3D,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;QAED,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;QACnC,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;YAC5B,MAAM,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC1C,CAAC;QAED,OAAO,SAAS,CAAC,KAAK,CAAC;IACzB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,4EAA4E;AAC5E,wEAAwE;AACxE,8EAA8E;AAC9E,OAAO;AACP,MAAM,UAAU,GAAG,CACjB,KAAc,EACyC,EAAE,CACzD,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAE3C,8EAA8E;AAC9E,wEAAwE;AACxE,6EAA6E;AAC7E,qBAAqB;AACrB,MAAM,eAAe,GAAG,CACtB,UAE2C,EAC3C,IAAa,EAC0C,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC"}
@@ -1,36 +0,0 @@
1
- import { type UnknownResult } from '../result.mjs';
2
- import { type NarrowToErr, type UnwrapOk } from './types.mjs';
3
- /**
4
- * Unwraps a `Result` inside a {@link Result.safeTry} generator body via
5
- * `yield*`, emulating Rust's `?` operator.
6
- *
7
- * If the `Result` is `Ok`, the `yield*` expression evaluates to the contained
8
- * value and execution continues. If it is `Err`, the error is yielded to
9
- * {@link Result.safeTry}, which returns it immediately — the rest of the
10
- * generator body never runs.
11
- *
12
- * This generator must only be delegated to (`yield*`) inside a
13
- * {@link Result.safeTry} body; resuming it after it has yielded an `Err`
14
- * throws.
15
- *
16
- * @example
17
- *
18
- * ```ts
19
- * const result = Result.safeTry(function* () {
20
- * const x = yield* Result.safeUnwrap(Result.ok(2));
21
- *
22
- * const y = yield* Result.safeUnwrap(Result.ok(3));
23
- *
24
- * return Result.ok(x + y);
25
- * });
26
- *
27
- * assert.deepStrictEqual(result, Result.ok(5));
28
- * ```
29
- *
30
- * @template R The input `UnknownResult` type.
31
- * @param result The `Result` to unwrap.
32
- * @returns A generator that yields the `Err` (if any) and returns the `Ok`
33
- * value.
34
- */
35
- export declare function safeUnwrap<R extends UnknownResult>(result: R): Generator<NarrowToErr<R>, UnwrapOk<R>, unknown>;
36
- //# sourceMappingURL=result-safe-unwrap.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-safe-unwrap.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-safe-unwrap.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAiB,UAAU,CAAC,CAAC,SAAS,aAAa,EACjD,MAAM,EAAE,CAAC,GACR,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAWjD"}
@@ -1,42 +0,0 @@
1
- import { isErr } from './result-is-err.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
-
28
-
29
-
30
-
31
-
32
-
33
-
34
- export function* safeUnwrap(result) {
35
- if (isErr(result)) {
36
- yield result;
37
- throw new Error('`safeUnwrap()` generator was resumed after yielding an `Err`; it must only be used via `yield*` inside `safeTry()`');
38
- }
39
-
40
- return result.value;
41
- }
42
- //# sourceMappingURL=result-safe-unwrap.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-safe-unwrap.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-safe-unwrap.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,SAAS,CAAC,CAAC,UAAU,CACzB,MAAS;IAET,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QAClB,MAAM,MAAM,CAAC;QAEb,MAAM,IAAI,KAAK,CACb,oHAAoH,CACrH,CAAC;IACJ,CAAC;IAED,oEAAoE;IACpE,OAAO,MAAM,CAAC,KAAoB,CAAC;AACrC,CAAC"}
@@ -1,23 +0,0 @@
1
- import { type Result, type UnknownResult } from '../result.mjs';
2
- import { type UnwrapErr, type UnwrapOk } from './types.mjs';
3
- /**
4
- * Swaps the success and error values of a `Result`.
5
- *
6
- * @example
7
- *
8
- * ```ts
9
- * const okValue = Result.ok('value');
10
- *
11
- * const errValue = Result.err('error');
12
- *
13
- * assert.deepStrictEqual(Result.swap(okValue), Result.err('value'));
14
- *
15
- * assert.deepStrictEqual(Result.swap(errValue), Result.ok('error'));
16
- * ```
17
- *
18
- * @template R The input `UnknownResult` type.
19
- * @param result The `Result` to swap.
20
- * @returns A new `Result` with success and error swapped.
21
- */
22
- export declare const swap: <R extends UnknownResult>(result: R) => Result<UnwrapErr<R>, UnwrapOk<R>>;
23
- //# sourceMappingURL=result-swap.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-swap.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-swap.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAKhE,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5D;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,IAAI,GAAI,CAAC,SAAS,aAAa,UAClC,CAAC,KACR,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAEsC,CAAC"}
@@ -1,27 +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
- import { unwrapOk } from './result-unwrap-ok.mjs';
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
- export const swap = (result) =>
25
-
26
- isOk(result) ? err(unwrapOk(result)) : ok(result.value);
27
- //# sourceMappingURL=result-swap.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-swap.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-swap.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;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,MAAS,EAC0B,EAAE;AACrC,oEAAoE;AACpE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,KAAqB,CAAC,CAAC"}
@@ -1,32 +0,0 @@
1
- import { Optional } from '../../optional/index.mjs';
2
- import { type UnknownResult } from '../result.mjs';
3
- import { type UnwrapOk } from './types.mjs';
4
- /**
5
- * Converts a `Result` to an `Optional`.
6
- *
7
- * This conversion is useful when you want to discard error information and
8
- * only care about whether an operation succeeded. The error information is
9
- * lost in this conversion, so use it when error details are not needed.
10
- *
11
- * If the `Result` is `Ok`, returns `Some` with the value. If the `Result` is
12
- * `Err`, returns `None`.
13
- *
14
- * @example
15
- *
16
- * ```ts
17
- * const okValue = Result.ok(7);
18
- *
19
- * const errValue = Result.err('fail');
20
- *
21
- * assert.deepStrictEqual(Result.toOptional(okValue), Optional.some(7));
22
- *
23
- * assert.deepStrictEqual(Result.toOptional(errValue), Optional.none);
24
- * ```
25
- *
26
- * @template R The input `UnknownResult` type.
27
- * @param result The `Result` to convert.
28
- * @returns An `Optional<UnwrapOk<R>>` containing the success value or
29
- * representing `None`.
30
- */
31
- export declare const toOptional: <R extends UnknownResult>(result: R) => Optional<UnwrapOk<R>>;
32
- //# sourceMappingURL=result-to-optional.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-to-optional.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-to-optional.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,aAAa,UACxC,CAAC,KACR,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CACyC,CAAC"}
@@ -1,32 +0,0 @@
1
- import { Optional } from '../../optional/index.mjs';
2
- import { isOk } from './result-is-ok.mjs';
3
- import { unwrapOk } from './result-unwrap-ok.mjs';
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
- export const toOptional = (result) => isOk(result) ? Optional.some(unwrapOk(result)) : Optional.none;
32
- //# sourceMappingURL=result-to-optional.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-to-optional.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-to-optional.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,MAAS,EACc,EAAE,CACzB,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC"}
@@ -1,33 +0,0 @@
1
- import { type UnknownResult } from '../result.mjs';
2
- import { type UnwrapErr } from './types.mjs';
3
- /**
4
- * Unwraps a `Result`, returning the error value or a default value if it is
5
- * `Result.Ok`.
6
- *
7
- * @example
8
- *
9
- * ```ts
10
- * const okResult = Result.ok('success');
11
- *
12
- * const errResult = Result.err('failure');
13
- *
14
- * assert.isTrue(Result.unwrapErrOr(okResult, 'default') === 'default');
15
- *
16
- * assert.isTrue(Result.unwrapErrOr(errResult, 'default') === 'failure');
17
- *
18
- * const unwrapError = Result.unwrapErrOr('fallback error');
19
- *
20
- * assert.isTrue(unwrapError(Result.err('boom')) === 'boom');
21
- *
22
- * assert.isTrue(unwrapError(Result.ok('no error')) === 'fallback error');
23
- * ```
24
- *
25
- * @template R The `UnknownResult` type to unwrap.
26
- * @template D The type of the default value.
27
- * @param result The `Result` to unwrap.
28
- * @param defaultValue The value to return if `result` is `Result.Ok`.
29
- * @returns The error value if `Result.Err`, otherwise `defaultValue`.
30
- */
31
- export declare function unwrapErrOr<R extends UnknownResult, D>(result: R, defaultValue: D): D | UnwrapErr<R>;
32
- export declare function unwrapErrOr<D>(defaultValue: D): <R extends UnknownResult>(result: R) => D | UnwrapErr<R>;
33
- //# sourceMappingURL=result-unwrap-err-or.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-unwrap-err-or.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-unwrap-err-or.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,aAAa,EAAE,CAAC,EACpD,MAAM,EAAE,CAAC,EACT,YAAY,EAAE,CAAC,GACd,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAGpB,wBAAgB,WAAW,CAAC,CAAC,EAC3B,YAAY,EAAE,CAAC,GACd,CAAC,CAAC,SAAS,aAAa,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC"}
@@ -1,17 +0,0 @@
1
- import { unwrapErr } from './result-unwrap-err.mjs';
2
- export function unwrapErrOr(...args) {
3
- switch (args.length) {
4
- case 2: {
5
-
6
- const [result, defaultValue] = args;
7
- return unwrapErrOrImpl(result, defaultValue);
8
- }
9
- case 1: {
10
-
11
- const [defaultValue] = args;
12
- return (result) => unwrapErrOrImpl(result, defaultValue);
13
- }
14
- }
15
- }
16
- const unwrapErrOrImpl = (result, defaultValue) => unwrapErr(result) ?? defaultValue;
17
- //# sourceMappingURL=result-unwrap-err-or.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-unwrap-err-or.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-unwrap-err-or.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAyCpD,MAAM,UAAU,WAAW,CACzB,GAAG,IAAwE;IAE3E,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,CAAC,EAAE,CAAC;YACP,2CAA2C;YAC3C,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,IAAI,CAAC;YAEpC,OAAO,eAAe,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAC/C,CAAC;QAED,KAAK,CAAC,EAAE,CAAC;YACP,kBAAkB;YAClB,MAAM,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;YAE5B,OAAO,CAAC,MAAS,EAAE,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,eAAe,GAAG,CACtB,MAAS,EACT,YAAe,EACG,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,YAAY,CAAC"}
@@ -1,33 +0,0 @@
1
- import { type UnknownResult } from '../result.mjs';
2
- import { type UnwrapErr, type UnwrapOk } from './types.mjs';
3
- /**
4
- * Unwraps a `Result`, returning the error value. Throws an error if the
5
- * `Result` is `Result.Ok`.
6
- *
7
- * This function is used when you expect a Result to be an error and want to
8
- * extract the error value. If the Result is unexpectedly Ok, it will throw an
9
- * error with information about the unexpected success value.
10
- *
11
- * @example
12
- *
13
- * ```ts
14
- * const errResult = Result.err(new Error('broken'));
15
- *
16
- * const okResult = Result.ok('value');
17
- *
18
- * assert.isTrue(Result.unwrapErrThrow(errResult).message === 'broken');
19
- *
20
- * assert.throws(() => Result.unwrapErrThrow(okResult), /Expected Err/u);
21
- * ```
22
- *
23
- * @template R The `UnknownResult` type to unwrap.
24
- * @param result The `Result` to unwrap.
25
- * @param toStr An optional function to convert the success value to a string
26
- * for the error message when the Result is unexpectedly Ok. Defaults to
27
- * `String`.
28
- * @returns The error value if `Result.Err`.
29
- * @throws {Error} Error with message "Expected Err but got Ok: {value}" if
30
- * the `Result` is `Result.Ok`.
31
- */
32
- export declare const unwrapErrThrow: <R extends UnknownResult>(result: R, toStr?: (v: UnwrapOk<R>) => string) => UnwrapErr<R>;
33
- //# sourceMappingURL=result-unwrap-err-throw.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-unwrap-err-throw.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-unwrap-err-throw.mts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,aAAa,UAC5C,CAAC,UACF,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,MAAM,KAChC,SAAS,CAAC,CAAC,CAiBb,CAAC"}
@@ -1,46 +0,0 @@
1
- import { unknownToString } from '../../../others/index.mjs';
2
- import { match } from '../../match.mjs';
3
- import { isErr } from './result-is-err.mjs';
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
- export const unwrapErrThrow = (result, toStr = unknownToString) => {
34
- if (isErr(result)) {
35
-
36
- return result.value;
37
- }
38
- const variant = match(result.$$tag, {
39
- 'ts-data-forge::Result.ok': 'Ok',
40
- 'ts-data-forge::Result.err': 'Err',
41
- });
42
- throw new Error(`Expected Err but got ${variant}: ${toStr(
43
-
44
- result.value)}`);
45
- };
46
- //# sourceMappingURL=result-unwrap-err-throw.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-unwrap-err-throw.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-unwrap-err-throw.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,MAAS,EACT,KAAK,GAA+B,eAAe,EACrC,EAAE;IAChB,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QAClB,oEAAoE;QACpE,OAAO,MAAM,CAAC,KAAqB,CAAC;IACtC,CAAC;IAED,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE;QAClC,0BAA0B,EAAE,IAAI;QAChC,2BAA2B,EAAE,KAAK;KACnC,CAAC,CAAC;IAEH,MAAM,IAAI,KAAK,CACb,wBAAwB,OAAO,KAAK,KAAK;IACvC,oEAAoE;IACpE,MAAM,CAAC,KAAoB,CAC5B,EAAE,CACJ,CAAC;AACJ,CAAC,CAAC"}
@@ -1,33 +0,0 @@
1
- import { type UnknownResult } from '../result.mjs';
2
- import { type UnwrapErr } from './types.mjs';
3
- /**
4
- * Unwraps a `Result`, returning the error value or `undefined` if it is
5
- * `Result.Ok`.
6
- *
7
- * This provides a safe way to extract error values from Results without
8
- * throwing exceptions. Useful for error handling patterns where you want to
9
- * check for specific error conditions.
10
- *
11
- * @example
12
- *
13
- * ```ts
14
- * const okResult = Result.ok('data');
15
- *
16
- * const errResult = Result.err('problem');
17
- *
18
- * // Result.unwrapErr returns undefined for Ok results
19
- *
20
- * // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
21
- * assert.isTrue(Result.unwrapErr(okResult) === undefined);
22
- *
23
- * // Result.unwrapErr returns the error value for Err results
24
- *
25
- * assert.isTrue(Result.unwrapErr(errResult) === 'problem');
26
- * ```
27
- *
28
- * @template R The `UnknownResult` type to unwrap.
29
- * @param result The `Result` to unwrap.
30
- * @returns The error value if `Result.Err`, otherwise `undefined`.
31
- */
32
- export declare const unwrapErr: <R extends UnknownResult>(result: R) => UnwrapErr<R> | undefined;
33
- //# sourceMappingURL=result-unwrap-err.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-unwrap-err.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-unwrap-err.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,aAAa,UACvC,CAAC,KACR,SAAS,CAAC,CAAC,CAAC,GAAG,SAE0C,CAAC"}
@@ -1,34 +0,0 @@
1
- import { isErr } from './result-is-err.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
-
28
-
29
-
30
-
31
- export const unwrapErr = (result) =>
32
-
33
- isErr(result) ? result.value : undefined;
34
- //# sourceMappingURL=result-unwrap-err.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-unwrap-err.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-unwrap-err.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,MAAS,EACiB,EAAE;AAC5B,oEAAoE;AACpE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAE,MAAM,CAAC,KAAsB,CAAC,CAAC,CAAC,SAAS,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 a default value if it is
5
- * `Result.Err`.
6
- *
7
- * @example
8
- *
9
- * ```ts
10
- * const okValue = Result.ok(10);
11
- *
12
- * const errValue = Result.err('fail');
13
- *
14
- * assert.isTrue(Result.unwrapOkOr(okValue, 0) === 10);
15
- *
16
- * assert.isTrue(Result.unwrapOkOr(errValue, 0) === 0);
17
- *
18
- * const unwrapWithDefault = Result.unwrapOkOr(5);
19
- *
20
- * assert.isTrue(unwrapWithDefault(Result.ok(3)) === 3);
21
- *
22
- * assert.isTrue(unwrapWithDefault(Result.err('no data')) === 5);
23
- * ```
24
- *
25
- * @template R The `UnknownResult` type to unwrap.
26
- * @template D The type of the default value.
27
- * @param result The `Result` to unwrap.
28
- * @param defaultValue The value to return if `result` is `Result.Err`.
29
- * @returns The success value if `Result.Ok`, otherwise `defaultValue`.
30
- */
31
- export declare function unwrapOkOr<R extends UnknownResult, D>(result: R, defaultValue: D): D | UnwrapOk<R>;
32
- export declare function unwrapOkOr<D>(defaultValue: D): <R extends UnknownResult>(result: R) => D | UnwrapOk<R>;
33
- //# sourceMappingURL=result-unwrap-ok-or.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-unwrap-ok-or.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-unwrap-ok-or.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,aAAa,EAAE,CAAC,EACnD,MAAM,EAAE,CAAC,EACT,YAAY,EAAE,CAAC,GACd,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;AAGnB,wBAAgB,UAAU,CAAC,CAAC,EAC1B,YAAY,EAAE,CAAC,GACd,CAAC,CAAC,SAAS,aAAa,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC"}
@@ -1,17 +0,0 @@
1
- import { unwrapOk } from './result-unwrap-ok.mjs';
2
- export function unwrapOkOr(...args) {
3
- switch (args.length) {
4
- case 2: {
5
-
6
- const [result, defaultValue] = args;
7
- return unwrapOkOrImpl(result, defaultValue);
8
- }
9
- case 1: {
10
-
11
- const [defaultValue] = args;
12
- return (result) => unwrapOkOrImpl(result, defaultValue);
13
- }
14
- }
15
- }
16
- const unwrapOkOrImpl = (result, defaultValue) => unwrapOk(result) ?? defaultValue;
17
- //# sourceMappingURL=result-unwrap-ok-or.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-unwrap-ok-or.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-unwrap-ok-or.mts"],"names":[],"mappings":"AACA,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,YAAY,CAAC,GAAG,IAAI,CAAC;YAEpC,OAAO,cAAc,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAC9C,CAAC;QAED,KAAK,CAAC,EAAE,CAAC;YACP,kBAAkB;YAClB,MAAM,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;YAE5B,OAAO,CAAC,MAAS,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,cAAc,GAAG,CACrB,MAAS,EACT,YAAe,EACE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,YAAY,CAAC"}
@@ -1,26 +0,0 @@
1
- import { type Ok } from '../../../types.mjs';
2
- import { type UnknownResult } from '../result.mjs';
3
- import { type UnwrapOk } from './types.mjs';
4
- /**
5
- * Safely unwraps the success value, returning `undefined` for failures.
6
- *
7
- * @example
8
- *
9
- * ```ts
10
- * const okResult = Result.ok(42);
11
- *
12
- * const errResult = Result.err('oops');
13
- *
14
- * // Result.unwrapOk returns the value for Ok results
15
- *
16
- * assert.isTrue(Result.unwrapOk(okResult) === 42);
17
- *
18
- * // Result.unwrapOk returns undefined for Err results
19
- *
20
- * // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
21
- * assert.isTrue(Result.unwrapOk(errResult) === undefined);
22
- * ```
23
- */
24
- export declare function unwrapOk<R extends Ok<unknown>>(result: R): UnwrapOk<R>;
25
- export declare function unwrapOk<R extends UnknownResult>(result: R): UnwrapOk<R> | undefined;
26
- //# sourceMappingURL=result-unwrap-ok.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result-unwrap-ok.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-unwrap-ok.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;AAExE,wBAAgB,QAAQ,CAAC,CAAC,SAAS,aAAa,EAC9C,MAAM,EAAE,CAAC,GACR,QAAQ,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC"}
@@ -1,8 +0,0 @@
1
- import { isOk } from './result-is-ok.mjs';
2
- export function unwrapOk(result) {
3
- return isOk(result)
4
- ?
5
- result.value
6
- : undefined;
7
- }
8
- //# sourceMappingURL=result-unwrap-ok.mjs.map