ts-data-forge 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (292) hide show
  1. package/README.md +1 -1
  2. package/dist/array/array-utils.d.mts +2617 -0
  3. package/dist/array/array-utils.d.mts.map +1 -0
  4. package/dist/array/array-utils.mjs +2915 -0
  5. package/dist/array/array-utils.mjs.map +1 -0
  6. package/dist/array/index.d.mts +3 -0
  7. package/dist/array/index.d.mts.map +1 -0
  8. package/dist/array/index.mjs +3 -0
  9. package/dist/array/index.mjs.map +1 -0
  10. package/dist/array/tuple-utils.d.mts +421 -0
  11. package/dist/array/tuple-utils.d.mts.map +1 -0
  12. package/dist/array/tuple-utils.mjs +391 -0
  13. package/dist/array/tuple-utils.mjs.map +1 -0
  14. package/dist/collections/imap-mapped.d.mts +445 -0
  15. package/dist/collections/imap-mapped.d.mts.map +1 -0
  16. package/dist/collections/imap-mapped.mjs +424 -0
  17. package/dist/collections/imap-mapped.mjs.map +1 -0
  18. package/dist/collections/imap.d.mts +359 -0
  19. package/dist/collections/imap.d.mts.map +1 -0
  20. package/dist/collections/imap.mjs +338 -0
  21. package/dist/collections/imap.mjs.map +1 -0
  22. package/dist/collections/index.d.mts +7 -0
  23. package/dist/collections/index.d.mts.map +1 -0
  24. package/dist/collections/index.mjs +7 -0
  25. package/dist/collections/index.mjs.map +1 -0
  26. package/dist/collections/iset-mapped.d.mts +576 -0
  27. package/dist/collections/iset-mapped.d.mts.map +1 -0
  28. package/dist/collections/iset-mapped.mjs +522 -0
  29. package/dist/collections/iset-mapped.mjs.map +1 -0
  30. package/dist/collections/iset.d.mts +426 -0
  31. package/dist/collections/iset.d.mts.map +1 -0
  32. package/dist/collections/iset.mjs +437 -0
  33. package/dist/collections/iset.mjs.map +1 -0
  34. package/dist/collections/queue.d.mts +190 -0
  35. package/dist/collections/queue.d.mts.map +1 -0
  36. package/dist/collections/queue.mjs +317 -0
  37. package/dist/collections/queue.mjs.map +1 -0
  38. package/dist/collections/stack.d.mts +210 -0
  39. package/dist/collections/stack.d.mts.map +1 -0
  40. package/dist/collections/stack.mjs +353 -0
  41. package/dist/collections/stack.mjs.map +1 -0
  42. package/dist/expect-type.d.mts +199 -0
  43. package/dist/expect-type.d.mts.map +1 -0
  44. package/dist/expect-type.mjs +201 -0
  45. package/dist/expect-type.mjs.map +1 -0
  46. package/dist/functional/index.d.mts +5 -0
  47. package/dist/functional/index.d.mts.map +1 -0
  48. package/dist/functional/index.mjs +5 -0
  49. package/dist/functional/index.mjs.map +1 -0
  50. package/dist/functional/match.d.mts +215 -0
  51. package/dist/functional/match.d.mts.map +1 -0
  52. package/dist/functional/match.mjs +139 -0
  53. package/dist/functional/match.mjs.map +1 -0
  54. package/dist/functional/optional.d.mts +517 -0
  55. package/dist/functional/optional.d.mts.map +1 -0
  56. package/dist/functional/optional.mjs +532 -0
  57. package/dist/functional/optional.mjs.map +1 -0
  58. package/dist/functional/pipe.d.mts +185 -0
  59. package/dist/functional/pipe.d.mts.map +1 -0
  60. package/dist/functional/pipe.mjs +129 -0
  61. package/dist/functional/pipe.mjs.map +1 -0
  62. package/dist/functional/result.d.mts +796 -0
  63. package/dist/functional/result.d.mts.map +1 -0
  64. package/dist/functional/result.mjs +844 -0
  65. package/dist/functional/result.mjs.map +1 -0
  66. package/dist/globals.d.mts +38 -0
  67. package/dist/guard/has-key.d.mts +100 -0
  68. package/dist/guard/has-key.d.mts.map +1 -0
  69. package/dist/guard/has-key.mjs +94 -0
  70. package/dist/guard/has-key.mjs.map +1 -0
  71. package/dist/guard/index.d.mts +8 -0
  72. package/dist/guard/index.d.mts.map +1 -0
  73. package/dist/guard/index.mjs +8 -0
  74. package/dist/guard/index.mjs.map +1 -0
  75. package/dist/guard/is-non-empty-string.d.mts +106 -0
  76. package/dist/guard/is-non-empty-string.d.mts.map +1 -0
  77. package/dist/guard/is-non-empty-string.mjs +108 -0
  78. package/dist/guard/is-non-empty-string.mjs.map +1 -0
  79. package/dist/guard/is-non-null-object.d.mts +105 -0
  80. package/dist/guard/is-non-null-object.d.mts.map +1 -0
  81. package/dist/guard/is-non-null-object.mjs +108 -0
  82. package/dist/guard/is-non-null-object.mjs.map +1 -0
  83. package/dist/guard/is-primitive.d.mts +146 -0
  84. package/dist/guard/is-primitive.d.mts.map +1 -0
  85. package/dist/guard/is-primitive.mjs +161 -0
  86. package/dist/guard/is-primitive.mjs.map +1 -0
  87. package/dist/guard/is-record.d.mts +151 -0
  88. package/dist/guard/is-record.d.mts.map +1 -0
  89. package/dist/guard/is-record.mjs +155 -0
  90. package/dist/guard/is-record.mjs.map +1 -0
  91. package/dist/guard/is-type.d.mts +430 -0
  92. package/dist/guard/is-type.d.mts.map +1 -0
  93. package/dist/guard/is-type.mjs +432 -0
  94. package/dist/guard/is-type.mjs.map +1 -0
  95. package/dist/guard/key-is-in.d.mts +158 -0
  96. package/dist/guard/key-is-in.d.mts.map +1 -0
  97. package/dist/guard/key-is-in.mjs +160 -0
  98. package/dist/guard/key-is-in.mjs.map +1 -0
  99. package/dist/index.d.mts +11 -0
  100. package/dist/index.d.mts.map +1 -0
  101. package/dist/index.mjs +61 -0
  102. package/dist/index.mjs.map +1 -0
  103. package/dist/iterator/index.d.mts +2 -0
  104. package/dist/iterator/index.d.mts.map +1 -0
  105. package/dist/iterator/index.mjs +2 -0
  106. package/dist/iterator/index.mjs.map +1 -0
  107. package/dist/iterator/range.d.mts +97 -0
  108. package/dist/iterator/range.d.mts.map +1 -0
  109. package/dist/iterator/range.mjs +130 -0
  110. package/dist/iterator/range.mjs.map +1 -0
  111. package/dist/json/index.d.mts +2 -0
  112. package/dist/json/index.d.mts.map +1 -0
  113. package/dist/json/index.mjs +2 -0
  114. package/dist/json/index.mjs.map +1 -0
  115. package/dist/json/json.d.mts +597 -0
  116. package/dist/json/json.d.mts.map +1 -0
  117. package/dist/json/json.mjs +687 -0
  118. package/dist/json/json.mjs.map +1 -0
  119. package/dist/number/branded-types/finite-number.d.mts +291 -0
  120. package/dist/number/branded-types/finite-number.d.mts.map +1 -0
  121. package/dist/number/branded-types/finite-number.mjs +296 -0
  122. package/dist/number/branded-types/finite-number.mjs.map +1 -0
  123. package/dist/number/branded-types/index.d.mts +27 -0
  124. package/dist/number/branded-types/index.d.mts.map +1 -0
  125. package/dist/number/branded-types/index.mjs +27 -0
  126. package/dist/number/branded-types/index.mjs.map +1 -0
  127. package/dist/number/branded-types/int.d.mts +242 -0
  128. package/dist/number/branded-types/int.d.mts.map +1 -0
  129. package/dist/number/branded-types/int.mjs +239 -0
  130. package/dist/number/branded-types/int.mjs.map +1 -0
  131. package/dist/number/branded-types/int16.d.mts +162 -0
  132. package/dist/number/branded-types/int16.d.mts.map +1 -0
  133. package/dist/number/branded-types/int16.mjs +141 -0
  134. package/dist/number/branded-types/int16.mjs.map +1 -0
  135. package/dist/number/branded-types/int32.d.mts +155 -0
  136. package/dist/number/branded-types/int32.d.mts.map +1 -0
  137. package/dist/number/branded-types/int32.mjs +142 -0
  138. package/dist/number/branded-types/int32.mjs.map +1 -0
  139. package/dist/number/branded-types/non-negative-finite-number.d.mts +165 -0
  140. package/dist/number/branded-types/non-negative-finite-number.d.mts.map +1 -0
  141. package/dist/number/branded-types/non-negative-finite-number.mjs +160 -0
  142. package/dist/number/branded-types/non-negative-finite-number.mjs.map +1 -0
  143. package/dist/number/branded-types/non-negative-int16.d.mts +160 -0
  144. package/dist/number/branded-types/non-negative-int16.d.mts.map +1 -0
  145. package/dist/number/branded-types/non-negative-int16.mjs +138 -0
  146. package/dist/number/branded-types/non-negative-int16.mjs.map +1 -0
  147. package/dist/number/branded-types/non-negative-int32.d.mts +156 -0
  148. package/dist/number/branded-types/non-negative-int32.d.mts.map +1 -0
  149. package/dist/number/branded-types/non-negative-int32.mjs +138 -0
  150. package/dist/number/branded-types/non-negative-int32.mjs.map +1 -0
  151. package/dist/number/branded-types/non-zero-finite-number.d.mts +154 -0
  152. package/dist/number/branded-types/non-zero-finite-number.d.mts.map +1 -0
  153. package/dist/number/branded-types/non-zero-finite-number.mjs +160 -0
  154. package/dist/number/branded-types/non-zero-finite-number.mjs.map +1 -0
  155. package/dist/number/branded-types/non-zero-int.d.mts +131 -0
  156. package/dist/number/branded-types/non-zero-int.d.mts.map +1 -0
  157. package/dist/number/branded-types/non-zero-int.mjs +128 -0
  158. package/dist/number/branded-types/non-zero-int.mjs.map +1 -0
  159. package/dist/number/branded-types/non-zero-int16.d.mts +166 -0
  160. package/dist/number/branded-types/non-zero-int16.d.mts.map +1 -0
  161. package/dist/number/branded-types/non-zero-int16.mjs +145 -0
  162. package/dist/number/branded-types/non-zero-int16.mjs.map +1 -0
  163. package/dist/number/branded-types/non-zero-int32.d.mts +158 -0
  164. package/dist/number/branded-types/non-zero-int32.d.mts.map +1 -0
  165. package/dist/number/branded-types/non-zero-int32.mjs +145 -0
  166. package/dist/number/branded-types/non-zero-int32.mjs.map +1 -0
  167. package/dist/number/branded-types/non-zero-safe-int.d.mts +148 -0
  168. package/dist/number/branded-types/non-zero-safe-int.d.mts.map +1 -0
  169. package/dist/number/branded-types/non-zero-safe-int.mjs +145 -0
  170. package/dist/number/branded-types/non-zero-safe-int.mjs.map +1 -0
  171. package/dist/number/branded-types/non-zero-uint16.d.mts +160 -0
  172. package/dist/number/branded-types/non-zero-uint16.d.mts.map +1 -0
  173. package/dist/number/branded-types/non-zero-uint16.mjs +140 -0
  174. package/dist/number/branded-types/non-zero-uint16.mjs.map +1 -0
  175. package/dist/number/branded-types/non-zero-uint32.d.mts +156 -0
  176. package/dist/number/branded-types/non-zero-uint32.d.mts.map +1 -0
  177. package/dist/number/branded-types/non-zero-uint32.mjs +140 -0
  178. package/dist/number/branded-types/non-zero-uint32.mjs.map +1 -0
  179. package/dist/number/branded-types/positive-finite-number.d.mts +171 -0
  180. package/dist/number/branded-types/positive-finite-number.d.mts.map +1 -0
  181. package/dist/number/branded-types/positive-finite-number.mjs +165 -0
  182. package/dist/number/branded-types/positive-finite-number.mjs.map +1 -0
  183. package/dist/number/branded-types/positive-int.d.mts +270 -0
  184. package/dist/number/branded-types/positive-int.d.mts.map +1 -0
  185. package/dist/number/branded-types/positive-int.mjs +257 -0
  186. package/dist/number/branded-types/positive-int.mjs.map +1 -0
  187. package/dist/number/branded-types/positive-int16.d.mts +162 -0
  188. package/dist/number/branded-types/positive-int16.d.mts.map +1 -0
  189. package/dist/number/branded-types/positive-int16.mjs +139 -0
  190. package/dist/number/branded-types/positive-int16.mjs.map +1 -0
  191. package/dist/number/branded-types/positive-int32.d.mts +158 -0
  192. package/dist/number/branded-types/positive-int32.d.mts.map +1 -0
  193. package/dist/number/branded-types/positive-int32.mjs +139 -0
  194. package/dist/number/branded-types/positive-int32.mjs.map +1 -0
  195. package/dist/number/branded-types/positive-safe-int.d.mts +152 -0
  196. package/dist/number/branded-types/positive-safe-int.d.mts.map +1 -0
  197. package/dist/number/branded-types/positive-safe-int.mjs +138 -0
  198. package/dist/number/branded-types/positive-safe-int.mjs.map +1 -0
  199. package/dist/number/branded-types/positive-uint16.d.mts +160 -0
  200. package/dist/number/branded-types/positive-uint16.d.mts.map +1 -0
  201. package/dist/number/branded-types/positive-uint16.mjs +139 -0
  202. package/dist/number/branded-types/positive-uint16.mjs.map +1 -0
  203. package/dist/number/branded-types/positive-uint32.d.mts +156 -0
  204. package/dist/number/branded-types/positive-uint32.d.mts.map +1 -0
  205. package/dist/number/branded-types/positive-uint32.mjs +139 -0
  206. package/dist/number/branded-types/positive-uint32.mjs.map +1 -0
  207. package/dist/number/branded-types/safe-int.d.mts +243 -0
  208. package/dist/number/branded-types/safe-int.d.mts.map +1 -0
  209. package/dist/number/branded-types/safe-int.mjs +240 -0
  210. package/dist/number/branded-types/safe-int.mjs.map +1 -0
  211. package/dist/number/branded-types/safe-uint.d.mts +151 -0
  212. package/dist/number/branded-types/safe-uint.d.mts.map +1 -0
  213. package/dist/number/branded-types/safe-uint.mjs +138 -0
  214. package/dist/number/branded-types/safe-uint.mjs.map +1 -0
  215. package/dist/number/branded-types/uint.d.mts +144 -0
  216. package/dist/number/branded-types/uint.d.mts.map +1 -0
  217. package/dist/number/branded-types/uint.mjs +132 -0
  218. package/dist/number/branded-types/uint.mjs.map +1 -0
  219. package/dist/number/branded-types/uint16.d.mts +157 -0
  220. package/dist/number/branded-types/uint16.d.mts.map +1 -0
  221. package/dist/number/branded-types/uint16.mjs +137 -0
  222. package/dist/number/branded-types/uint16.mjs.map +1 -0
  223. package/dist/number/branded-types/uint32.d.mts +185 -0
  224. package/dist/number/branded-types/uint32.d.mts.map +1 -0
  225. package/dist/number/branded-types/uint32.mjs +169 -0
  226. package/dist/number/branded-types/uint32.mjs.map +1 -0
  227. package/dist/number/enum/index.d.mts +3 -0
  228. package/dist/number/enum/index.d.mts.map +1 -0
  229. package/dist/number/enum/index.mjs +3 -0
  230. package/dist/number/enum/index.mjs.map +1 -0
  231. package/dist/number/enum/int8.d.mts +202 -0
  232. package/dist/number/enum/int8.d.mts.map +1 -0
  233. package/dist/number/enum/int8.mjs +296 -0
  234. package/dist/number/enum/int8.mjs.map +1 -0
  235. package/dist/number/enum/uint8.d.mts +128 -0
  236. package/dist/number/enum/uint8.d.mts.map +1 -0
  237. package/dist/number/enum/uint8.mjs +251 -0
  238. package/dist/number/enum/uint8.mjs.map +1 -0
  239. package/dist/number/index.d.mts +5 -0
  240. package/dist/number/index.d.mts.map +1 -0
  241. package/dist/number/index.mjs +31 -0
  242. package/dist/number/index.mjs.map +1 -0
  243. package/dist/number/num.d.mts +515 -0
  244. package/dist/number/num.d.mts.map +1 -0
  245. package/dist/number/num.mjs +513 -0
  246. package/dist/number/num.mjs.map +1 -0
  247. package/dist/number/refined-number-utils.d.mts +191 -0
  248. package/dist/number/refined-number-utils.d.mts.map +1 -0
  249. package/dist/number/refined-number-utils.mjs +179 -0
  250. package/dist/number/refined-number-utils.mjs.map +1 -0
  251. package/dist/object/index.d.mts +2 -0
  252. package/dist/object/index.d.mts.map +1 -0
  253. package/dist/object/index.mjs +2 -0
  254. package/dist/object/index.mjs.map +1 -0
  255. package/dist/object/object.d.mts +296 -0
  256. package/dist/object/object.d.mts.map +1 -0
  257. package/dist/object/object.mjs +295 -0
  258. package/dist/object/object.mjs.map +1 -0
  259. package/dist/others/cast-mutable.d.mts +110 -0
  260. package/dist/others/cast-mutable.d.mts.map +1 -0
  261. package/dist/others/cast-mutable.mjs +114 -0
  262. package/dist/others/cast-mutable.mjs.map +1 -0
  263. package/dist/others/cast-readonly.d.mts +189 -0
  264. package/dist/others/cast-readonly.d.mts.map +1 -0
  265. package/dist/others/cast-readonly.mjs +193 -0
  266. package/dist/others/cast-readonly.mjs.map +1 -0
  267. package/dist/others/if-then.d.mts +98 -0
  268. package/dist/others/if-then.d.mts.map +1 -0
  269. package/dist/others/if-then.mjs +100 -0
  270. package/dist/others/if-then.mjs.map +1 -0
  271. package/dist/others/index.d.mts +8 -0
  272. package/dist/others/index.d.mts.map +1 -0
  273. package/dist/others/index.mjs +8 -0
  274. package/dist/others/index.mjs.map +1 -0
  275. package/dist/others/map-nullable.d.mts +151 -0
  276. package/dist/others/map-nullable.d.mts.map +1 -0
  277. package/dist/others/map-nullable.mjs +159 -0
  278. package/dist/others/map-nullable.mjs.map +1 -0
  279. package/dist/others/memoize-function.d.mts +173 -0
  280. package/dist/others/memoize-function.d.mts.map +1 -0
  281. package/dist/others/memoize-function.mjs +189 -0
  282. package/dist/others/memoize-function.mjs.map +1 -0
  283. package/dist/others/tuple.d.mts +159 -0
  284. package/dist/others/tuple.d.mts.map +1 -0
  285. package/dist/others/tuple.mjs +161 -0
  286. package/dist/others/tuple.mjs.map +1 -0
  287. package/dist/others/unknown-to-string.d.mts +180 -0
  288. package/dist/others/unknown-to-string.d.mts.map +1 -0
  289. package/dist/others/unknown-to-string.mjs +211 -0
  290. package/dist/others/unknown-to-string.mjs.map +1 -0
  291. package/dist/tsconfig.json +1 -0
  292. package/package.json +16 -14
@@ -0,0 +1,517 @@
1
+ /** @internal Symbol to identify the 'Some' variant of Optional. */
2
+ declare const SomeTypeSymbol: unique symbol;
3
+ /** @internal Symbol to identify the 'None' variant of Optional. */
4
+ declare const NoneTypeSymbol: unique symbol;
5
+ /**
6
+ * @internal
7
+ * Represents the 'Some' variant of an Optional, containing a value.
8
+ * @template S The type of the contained value.
9
+ */
10
+ type Some_<S> = Readonly<{
11
+ /** Discriminant property for the 'Some' type. */
12
+ type: typeof SomeTypeSymbol;
13
+ /** The contained value. */
14
+ value: S;
15
+ }>;
16
+ /**
17
+ * @internal
18
+ * Represents the 'None' variant of an Optional, indicating the absence of a value.
19
+ */
20
+ type None_ = Readonly<{
21
+ /** Discriminant property for the 'None' type. */
22
+ type: typeof NoneTypeSymbol;
23
+ }>;
24
+ /**
25
+ * Represents an optional value that can either be 'Some' (containing a value) or 'None' (empty).
26
+ * @template S The type of the value that might be present.
27
+ */
28
+ export type Optional<S> = None_ | Some_<S>;
29
+ /**
30
+ * Namespace for the {@link Optional} type and related functions.
31
+ * Provides utilities to handle values that might be absent, similar to Option types in other languages.
32
+ */
33
+ export declare namespace Optional {
34
+ /**
35
+ * Checks if the given value is an {@link Optional}.
36
+ * @param maybeOptional The value to check.
37
+ * @returns `true` if the value is an {@link Optional}, otherwise `false`.
38
+ */
39
+ export const isOptional: (maybeOptional: unknown) => maybeOptional is Optional<unknown>;
40
+ /**
41
+ * Represents an {@link Optional} that contains a value.
42
+ * @template S The type of the contained value.
43
+ */
44
+ export type Some<S> = Some_<S>;
45
+ /**
46
+ * Represents an {@link Optional} that does not contain a value (is empty).
47
+ */
48
+ export type None = None_;
49
+ /**
50
+ * Base type for any {@link Optional}, used for generic constraints.
51
+ * Represents an {@link Optional} with an unknown value type.
52
+ */
53
+ export type Base = Optional<unknown>;
54
+ /**
55
+ * Extracts the value type `S` from an {@link Optional.Some}<S>.
56
+ * If the {@link Optional} is {@link Optional.None}, resolves to `never`.
57
+ * @template O The {@link Optional.Base} type to unwrap.
58
+ */
59
+ export type Unwrap<O extends Base> = O extends Some<infer S> ? S : never;
60
+ /**
61
+ * Narrows an {@link Optional.Base} type to {@link Optional.Some}<S> if it is a {@link Optional.Some}.
62
+ * If the {@link Optional} is {@link Optional.None}, resolves to `never`.
63
+ * @template O The {@link Optional.Base} type to narrow.
64
+ */
65
+ export type NarrowToSome<O extends Base> = O extends None ? never : O;
66
+ /**
67
+ * Narrows an {@link Optional.Base} type to {@link Optional.None} if it is a {@link Optional.None}.
68
+ * If the {@link Optional} is {@link Optional.Some}<S>, resolves to `never`.
69
+ * @template O The {@link Optional.Base} type to narrow.
70
+ */
71
+ export type NarrowToNone<O extends Base> = O extends None ? O : never;
72
+ /**
73
+ * Creates an {@link Optional.Some} containing the given value.
74
+ * @template S The type of the value.
75
+ * @param value The value to wrap in an {@link Optional.Some}.
76
+ * @returns An {@link Optional.Some}<S> containing the value.
77
+ * @example
78
+ * ```typescript
79
+ * const someValue = Optional.some(42);
80
+ * const someString = Optional.some("hello");
81
+ * const someObject = Optional.some({ name: "Alice", age: 30 });
82
+ *
83
+ * console.log(Optional.isSome(someValue)); // true
84
+ * console.log(Optional.unwrap(someValue)); // 42
85
+ * ```
86
+ */
87
+ export const some: <S>(value: S) => Some<S>;
88
+ /**
89
+ * The singleton instance representing {@link Optional.None} (an empty Optional).
90
+ * @example
91
+ * ```typescript
92
+ * const emptyValue = Optional.none;
93
+ *
94
+ * console.log(Optional.isNone(emptyValue)); // true
95
+ * console.log(Optional.unwrap(emptyValue)); // undefined
96
+ * console.log(Optional.unwrapOr(emptyValue, "default")); // "default"
97
+ * ```
98
+ */
99
+ export const none: None;
100
+ /**
101
+ * Checks if an {@link Optional} is {@link Optional.Some}.
102
+ * Acts as a type guard.
103
+ * @template O The {@link Optional.Base} type to check.
104
+ * @param optional The {@link Optional} to check.
105
+ * @returns `true` if the {@link Optional} is {@link Optional.Some}, `false` otherwise.
106
+ */
107
+ export const isSome: <O extends Base>(optional: O) => optional is NarrowToSome<O>;
108
+ /**
109
+ * Checks if an {@link Optional} is {@link Optional.None}.
110
+ * Acts as a type guard.
111
+ * @template O The {@link Optional.Base} type to check.
112
+ * @param optional The {@link Optional} to check.
113
+ * @returns `true` if the {@link Optional} is {@link Optional.None}, `false` otherwise.
114
+ */
115
+ export const isNone: <O extends Base>(optional: O) => optional is NarrowToNone<O>;
116
+ /**
117
+ * Unwraps an `Optional`, returning the contained value.
118
+ * Throws an error if the `Optional` is `Optional.None`.
119
+ *
120
+ * This is a safer alternative to direct value access when you know the Optional
121
+ * should contain a value. Use this method when an empty Optional represents
122
+ * a programming error or unexpected condition.
123
+ *
124
+ * @template O The `Optional.Base` type to unwrap.
125
+ * @param optional The `Optional` to unwrap.
126
+ * @returns The contained value if `Optional.Some`.
127
+ * @throws {Error} Error with message "`unwrapThrow()` has failed because it is `None`" if the `Optional` is `Optional.None`.
128
+ * @example
129
+ * ```typescript
130
+ * // Safe unwrapping when you know the value exists
131
+ * const config = loadConfig(); // returns Optional<Config>
132
+ * if (Optional.isSome(config)) {
133
+ * const value = Optional.unwrapThrow(config); // Safe to unwrap
134
+ * console.log(value); // Config object
135
+ * }
136
+ *
137
+ * // Unsafe unwrapping - will throw if empty
138
+ * const userInput = Optional.some(42);
139
+ * console.log(Optional.unwrapThrow(userInput)); // 42
140
+ *
141
+ * const empty = Optional.none;
142
+ * try {
143
+ * Optional.unwrapThrow(empty); // throws Error
144
+ * } catch (error) {
145
+ * console.log(error.message); // "`unwrapThrow()` has failed because it is `None`"
146
+ * }
147
+ * ```
148
+ */
149
+ export const unwrapThrow: <O extends Base>(optional: O) => Unwrap<O>;
150
+ /**
151
+ * Unwraps an `Optional`, returning the contained value or `undefined` if empty.
152
+ *
153
+ * This function provides a safe way to extract values from Optionals without
154
+ * throwing exceptions. It has overloaded behavior based on the type:
155
+ * - For `Optional.Some<T>`: Always returns `T` (guaranteed by type system)
156
+ * - For general `Optional<T>`: Returns `T | undefined`
157
+ *
158
+ * @template O The `Optional.Base` type to unwrap.
159
+ * @param optional The `Optional` to unwrap.
160
+ * @returns The contained value if `Optional.Some`, otherwise `undefined`.
161
+ * @example
162
+ * ```typescript
163
+ * // With Some - guaranteed to return value
164
+ * const some = Optional.some(42);
165
+ * const value = Optional.unwrap(some); // Type: number, Value: 42
166
+ *
167
+ * // With general Optional - may return undefined
168
+ * const maybeValue: Optional<string> = getOptionalString();
169
+ * const result = Optional.unwrap(maybeValue); // Type: string | undefined
170
+ *
171
+ * // Safe pattern for handling both cases
172
+ * const optional = Optional.some("hello");
173
+ * const unwrapped = Optional.unwrap(optional);
174
+ * if (unwrapped !== undefined) {
175
+ * console.log(unwrapped.toUpperCase()); // "HELLO"
176
+ * }
177
+ * ```
178
+ */
179
+ export const unwrap: UnwrapFnOverload;
180
+ type UnwrapFnOverload = {
181
+ <O extends Some<unknown>>(optional: O): Unwrap<O>;
182
+ <O extends Base>(optional: O): Unwrap<O> | undefined;
183
+ };
184
+ /**
185
+ * Unwraps an `Optional`, returning the contained value or a default value if it's `Optional.None`.
186
+ *
187
+ * Supports both direct usage and curried form for functional composition.
188
+ * This is often preferred over `unwrap()` when you have a sensible fallback value.
189
+ *
190
+ * @template O The `Optional.Base` type to unwrap.
191
+ * @template D The type of the default value.
192
+ * @param optional The `Optional` to unwrap.
193
+ * @param defaultValue The value to return if `optional` is `Optional.None`.
194
+ * @returns The contained value if `Optional.Some`, otherwise `defaultValue`.
195
+ * @example
196
+ * ```typescript
197
+ * // Direct usage - most common pattern
198
+ * const userAge = Optional.fromNullable(user.age);
199
+ * const displayAge = Optional.unwrapOr(userAge, "Unknown");
200
+ * console.log(`Age: ${displayAge}`); // "Age: 25" or "Age: Unknown"
201
+ *
202
+ * // With different Optional types
203
+ * const some = Optional.some(42);
204
+ * const value1 = Optional.unwrapOr(some, 0);
205
+ * console.log(value1); // 42
206
+ *
207
+ * const none = Optional.none;
208
+ * const value2 = Optional.unwrapOr(none, 0);
209
+ * console.log(value2); // 0
210
+ *
211
+ * // Curried usage for functional composition
212
+ * const unwrapWithDefault = Optional.unwrapOr("default");
213
+ * const result = pipe(Optional.some("hello"))
214
+ * .map(unwrapWithDefault)
215
+ * .value;
216
+ * console.log(result); // "hello"
217
+ *
218
+ * // Chaining with other Optional operations
219
+ * const processValue = (input: string) =>
220
+ * pipe(Optional.fromNullable(input))
221
+ * .map(Optional.map(s => s.toUpperCase()))
222
+ * .map(Optional.unwrapOr("NO INPUT"))
223
+ * .value;
224
+ * ```
225
+ */
226
+ export const unwrapOr: UnwrapOrFnOverload;
227
+ type UnwrapOrFnOverload = {
228
+ <O extends Base, D>(optional: O, defaultValue: D): D | Unwrap<O>;
229
+ <S, D>(defaultValue: D): (optional: Optional<S>) => D | S;
230
+ };
231
+ /**
232
+ * Returns the `Optional` if it is `Some`, otherwise returns the alternative.
233
+ *
234
+ * Provides a way to chain Optional operations with fallback values. This is
235
+ * particularly useful for implementing default behavior or cascading lookups.
236
+ * Supports both direct usage and curried form for functional composition.
237
+ *
238
+ * @template O The input `Optional.Base` type.
239
+ * @param optional The `Optional` to check.
240
+ * @param alternative The alternative `Optional` to return if the first is `None`.
241
+ * @returns The first `Optional` if `Some`, otherwise the alternative.
242
+ * @example
243
+ * ```typescript
244
+ * // Direct usage - cascading lookups
245
+ * const primaryConfig = loadPrimaryConfig(); // Optional<Config>
246
+ * const fallbackConfig = loadFallbackConfig(); // Optional<Config>
247
+ * const config = Optional.orElse(primaryConfig, fallbackConfig);
248
+ *
249
+ * // Multiple fallbacks
250
+ * const userPreference = getUserPreference(); // Optional<string>
251
+ * const systemDefault = Optional.some("default-theme");
252
+ * const theme = Optional.orElse(userPreference, systemDefault);
253
+ * console.log(Optional.unwrap(theme)); // User's preference or "default-theme"
254
+ *
255
+ * // Regular usage example
256
+ * const primary = Optional.none;
257
+ * const fallback = Optional.some("default");
258
+ * const result = Optional.orElse(primary, fallback);
259
+ * console.log(Optional.unwrap(result)); // "default"
260
+ *
261
+ * // Curried usage for functional composition
262
+ * const withFallback = Optional.orElse(Optional.some("fallback"));
263
+ * const result2 = pipe(Optional.none)
264
+ * .map(withFallback)
265
+ * .value;
266
+ * console.log(Optional.unwrap(result2)); // "fallback"
267
+ *
268
+ * // Chaining multiple orElse operations
269
+ * const finalResult = pipe(Optional.none)
270
+ * .map(Optional.orElse(Optional.none)) // Still none
271
+ * .map(Optional.orElse(Optional.some("last resort")))
272
+ * .value;
273
+ * ```
274
+ */
275
+ export const orElse: OrElseFnOverload;
276
+ type OrElseFnOverload = {
277
+ <O extends Base, const O2 extends Base>(optional: O, alternative: O2): O | O2;
278
+ <S, S2>(alternative: Optional<S2>): (optional: Optional<S>) => Optional<S> | Optional<S2>;
279
+ };
280
+ /**
281
+ * Maps an {@link Optional}<S> to {@link Optional}<S2> by applying a function to a contained value.
282
+ * If the {@link Optional} is {@link Optional.None}, it returns {@link Optional.none}.
283
+ * Otherwise, it applies the `mapFn` to the value in `Optional.Some` and returns a new `Optional.Some` with the result.
284
+ * @template O The input `Optional.Base` type.
285
+ * @template S2 The type of the value returned by the mapping function.
286
+ * @param optional The `Optional` to map.
287
+ * @param mapFn The function to apply to the value if it exists.
288
+ * @returns A new `Optional<S2>` resulting from the mapping, or `Optional.None` if the input was `Optional.None`.
289
+ * @example
290
+ * ```typescript
291
+ * const someNumber = Optional.some(5);
292
+ * const mapped = Optional.map(someNumber, x => x * 2);
293
+ * console.log(Optional.unwrap(mapped)); // 10
294
+ *
295
+ * const noneValue = Optional.none;
296
+ * const mappedNone = Optional.map(noneValue, x => x * 2);
297
+ * console.log(Optional.isNone(mappedNone)); // true
298
+ *
299
+ * // Chaining maps
300
+ * const result = Optional.map(
301
+ * Optional.map(Optional.some("hello"), s => s.toUpperCase()),
302
+ * s => s.length
303
+ * );
304
+ * console.log(Optional.unwrap(result)); // 5
305
+ *
306
+ * // Curried version for use with pipe
307
+ * const doubler = Optional.map((x: number) => x * 2);
308
+ * const result2 = pipe(Optional.some(5)).map(doubler).value;
309
+ * console.log(Optional.unwrap(result2)); // 10
310
+ * ```
311
+ */
312
+ export const map: MapFnOverload;
313
+ type MapFnOverload = {
314
+ <O extends Base, S2>(optional: O, mapFn: (value: Unwrap<O>) => S2): Optional<S2>;
315
+ <S, S2>(mapFn: (value: S) => S2): (optional: Optional<S>) => Optional<S2>;
316
+ };
317
+ /**
318
+ * Applies a function that returns an `Optional` to the value in an `Optional.Some`.
319
+ * If the input is `Optional.None`, returns `Optional.None`.
320
+ * This is the monadic bind operation for `Optional`.
321
+ * @template O The input `Optional.Base` type.
322
+ * @template S2 The value type of the `Optional` returned by the function.
323
+ * @param optional The `Optional` to flat map.
324
+ * @param flatMapFn The function to apply that returns an `Optional`.
325
+ * @returns The result of applying the function, or `Optional.None`.
326
+ * @example
327
+ * ```typescript
328
+ * // Regular usage
329
+ * const parseNumber = (s: string): Optional<number> => {
330
+ * const n = Number(s);
331
+ * return isNaN(n) ? Optional.none : Optional.some(n);
332
+ * };
333
+ *
334
+ * const result = Optional.flatMap(Optional.some("42"), parseNumber);
335
+ * console.log(Optional.unwrap(result)); // 42
336
+ *
337
+ * // Curried usage for pipe composition
338
+ * const parser = Optional.flatMap(parseNumber);
339
+ * const result2 = pipe(Optional.some("42")).map(parser).value;
340
+ * console.log(Optional.unwrap(result2)); // 42
341
+ * ```
342
+ */
343
+ export const flatMap: FlatMapFnOverload;
344
+ type FlatMapFnOverload = {
345
+ <O extends Base, S2>(optional: O, flatMapFn: (value: Unwrap<O>) => Optional<S2>): Optional<S2>;
346
+ <S, S2>(flatMapFn: (value: S) => Optional<S2>): (optional: Optional<S>) => Optional<S2>;
347
+ };
348
+ /**
349
+ * Filters an `Optional` based on a predicate.
350
+ * If the `Optional` is `Some` and the predicate returns true, returns the original `Optional`.
351
+ * Otherwise returns `None`.
352
+ * @template O The input `Optional.Base` type.
353
+ * @param optional The `Optional` to filter.
354
+ * @param predicate The predicate function.
355
+ * @returns The filtered `Optional`.
356
+ * @example
357
+ * ```typescript
358
+ * // Regular usage
359
+ * const someEven = Optional.some(4);
360
+ * const filtered = Optional.filter(someEven, x => x % 2 === 0);
361
+ * console.log(Optional.unwrap(filtered)); // 4
362
+ *
363
+ * // Curried usage for pipe composition
364
+ * const evenFilter = Optional.filter((x: number) => x % 2 === 0);
365
+ * const result = pipe(Optional.some(4)).map(evenFilter).value;
366
+ * console.log(Optional.unwrap(result)); // 4
367
+ * ```
368
+ */
369
+ export const filter: FilterFnOverload;
370
+ type FilterFnOverload = {
371
+ <O extends Base>(optional: O, predicate: (value: Unwrap<O>) => boolean): Optional<Unwrap<O>>;
372
+ <S>(predicate: (value: S) => boolean): (optional: Optional<S>) => Optional<S>;
373
+ };
374
+ /**
375
+ * Unwraps an `Optional`, returning the contained value or throwing an error with the provided message.
376
+ * @template O The `Optional.Base` type to unwrap.
377
+ * @param optional The `Optional` to unwrap.
378
+ * @param message The error message to throw if the `Optional` is `Optional.None`.
379
+ * @returns The contained value if `Optional.Some`.
380
+ * @throws Error with the provided message if the `Optional` is `Optional.None`.
381
+ * @example
382
+ * ```typescript
383
+ * // Regular usage
384
+ * const some = Optional.some(42);
385
+ * const value = Optional.expectToBe(some, "Value must exist");
386
+ * console.log(value); // 42
387
+ *
388
+ * // Curried usage for pipe composition
389
+ * const getValue = Optional.expectToBe("Value must exist");
390
+ * const value2 = pipe(Optional.some(42)).map(getValue).value;
391
+ * console.log(value2); // 42
392
+ * ```
393
+ */
394
+ export const expectToBe: ExpectToBeFnOverload;
395
+ type ExpectToBeFnOverload = {
396
+ <O extends Base>(optional: O, message: string): Unwrap<O>;
397
+ <S>(message: string): (optional: Optional<S>) => S;
398
+ };
399
+ /**
400
+ * Combines two `Optional` values into a single `Optional` containing a tuple.
401
+ * If either `Optional` is `None`, returns `None`.
402
+ * @template A The value type of the first `Optional`.
403
+ * @template B The value type of the second `Optional`.
404
+ * @param optionalA The first `Optional`.
405
+ * @param optionalB The second `Optional`.
406
+ * @returns An `Optional` containing a tuple of both values, or `None`.
407
+ * @example
408
+ * ```typescript
409
+ * const a = Optional.some(1);
410
+ * const b = Optional.some("hello");
411
+ * const zipped = Optional.zip(a, b);
412
+ * console.log(Optional.unwrap(zipped)); // [1, "hello"]
413
+ *
414
+ * const withNone = Optional.zip(a, Optional.none);
415
+ * console.log(Optional.isNone(withNone)); // true
416
+ * ```
417
+ */
418
+ export const zip: <A, const B>(optionalA: Optional<A>, optionalB: Optional<B>) => Optional<readonly [A, B]>;
419
+ /**
420
+ * Converts a nullable value to an `Optional`.
421
+ *
422
+ * This is the primary way to lift nullable values (null or undefined) into
423
+ * the Optional type system. The function treats both `null` and `undefined`
424
+ * as empty values, converting them to `Optional.None`.
425
+ *
426
+ * @template T The type of the nullable value.
427
+ * @param value The nullable value to convert.
428
+ * @returns `Optional.Some<NonNullable<T>>` if the value is not null or undefined, otherwise `Optional.None`.
429
+ * @example
430
+ * ```typescript
431
+ * // Basic nullable conversion
432
+ * const value: string | null = "hello";
433
+ * const optional = Optional.fromNullable(value);
434
+ * console.log(Optional.unwrap(optional)); // "hello"
435
+ * console.log(Optional.isSome(optional)); // true
436
+ *
437
+ * // Handling null values
438
+ * const nullValue: string | null = null;
439
+ * const noneOptional = Optional.fromNullable(nullValue);
440
+ * console.log(Optional.isNone(noneOptional)); // true
441
+ *
442
+ * // Handling undefined values
443
+ * const undefinedValue: number | undefined = undefined;
444
+ * const alsoNone = Optional.fromNullable(undefinedValue);
445
+ * console.log(Optional.isNone(alsoNone)); // true
446
+ *
447
+ * // Common use case with API responses
448
+ * interface User {
449
+ * name: string;
450
+ * email?: string; // Optional field
451
+ * }
452
+ *
453
+ * const user: User = { name: "John" };
454
+ * const email = Optional.fromNullable(user.email);
455
+ * const emailDisplay = Optional.unwrapOr(email, "No email provided");
456
+ * console.log(emailDisplay); // "No email provided"
457
+ *
458
+ * // Chaining with other Optional operations
459
+ * const processNullableInput = (input: string | null) =>
460
+ * Optional.fromNullable(input)
461
+ * .map(Optional.map(s => s.trim()))
462
+ * .map(Optional.filter(s => s.length > 0))
463
+ * .map(Optional.unwrapOr("empty input"));
464
+ * ```
465
+ */
466
+ export const fromNullable: <T>(value: T | null | undefined) => Optional<NonNullable<T>>;
467
+ /**
468
+ * Converts an `Optional` to a nullable value.
469
+ *
470
+ * This function extracts the value from an Optional, returning `undefined`
471
+ * for empty Optionals. This is useful when interfacing with APIs or systems
472
+ * that expect nullable values rather than Optional types.
473
+ *
474
+ * Note: This returns `undefined` (not `null`) for consistency with JavaScript's
475
+ * undefined semantics and TypeScript's optional properties.
476
+ *
477
+ * @template O The `Optional.Base` type to convert.
478
+ * @param optional The `Optional` to convert.
479
+ * @returns The contained value if `Some`, otherwise `undefined`.
480
+ * @example
481
+ * ```typescript
482
+ * // Basic conversion
483
+ * const some = Optional.some(42);
484
+ * console.log(Optional.toNullable(some)); // 42
485
+ *
486
+ * const none = Optional.none;
487
+ * console.log(Optional.toNullable(none)); // undefined
488
+ *
489
+ * // Interface with nullable APIs
490
+ * interface ApiResponse {
491
+ * data?: string;
492
+ * }
493
+ *
494
+ * const optionalData: Optional<string> = processData();
495
+ * const response: ApiResponse = {
496
+ * data: Optional.toNullable(optionalData)
497
+ * };
498
+ *
499
+ * // Converting back and forth
500
+ * const original: string | undefined = getValue();
501
+ * const optional = Optional.fromNullable(original);
502
+ * const processed = Optional.map(optional, s => s.toUpperCase());
503
+ * const result: string | undefined = Optional.toNullable(processed);
504
+ *
505
+ * // Useful in conditional logic
506
+ * const maybeUser = findUser(id);
507
+ * const userName = Optional.toNullable(maybeUser);
508
+ * if (userName !== undefined) {
509
+ * console.log(`Found user: ${userName}`);
510
+ * }
511
+ * ```
512
+ */
513
+ export const toNullable: <O extends Base>(optional: O) => Unwrap<O> | undefined;
514
+ export {};
515
+ }
516
+ export {};
517
+ //# sourceMappingURL=optional.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"optional.d.mts","sourceRoot":"","sources":["../../src/functional/optional.mts"],"names":[],"mappings":"AAIA,mEAAmE;AACnE,QAAA,MAAM,cAAc,EAAE,OAAO,MAAgC,CAAC;AAE9D,mEAAmE;AACnE,QAAA,MAAM,cAAc,EAAE,OAAO,MAAgC,CAAC;A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