@consolidados/results 0.1.2 → 0.1.4

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 (46) hide show
  1. package/README.md +2 -1
  2. package/dist/helpers/match.cjs +27 -0
  3. package/dist/helpers/match.cjs.map +1 -0
  4. package/dist/helpers/match.d.cts +13 -0
  5. package/dist/helpers/match.d.ts +13 -0
  6. package/dist/helpers/match.js +25 -0
  7. package/dist/helpers/match.js.map +1 -0
  8. package/dist/index.cjs +316 -0
  9. package/dist/index.cjs.map +1 -0
  10. package/dist/index.d.cts +5 -0
  11. package/dist/index.d.ts +5 -0
  12. package/dist/index.js +312 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/option/index.cjs +126 -0
  15. package/dist/option/index.cjs.map +1 -0
  16. package/dist/option/index.d.cts +2 -0
  17. package/dist/option/index.d.ts +2 -0
  18. package/dist/option/index.js +123 -0
  19. package/dist/option/index.js.map +1 -0
  20. package/dist/option/option.cjs +126 -0
  21. package/dist/option/option.cjs.map +1 -0
  22. package/dist/option/option.d.cts +25 -0
  23. package/dist/option/option.d.ts +25 -0
  24. package/dist/option/option.js +123 -0
  25. package/dist/option/option.js.map +1 -0
  26. package/dist/option-DpT8KCGE.d.cts +96 -0
  27. package/dist/option-DpT8KCGE.d.ts +96 -0
  28. package/dist/result/index.cjs +170 -0
  29. package/dist/result/index.cjs.map +1 -0
  30. package/dist/result/index.d.cts +3 -0
  31. package/dist/result/index.d.ts +3 -0
  32. package/dist/result/index.js +168 -0
  33. package/dist/result/index.js.map +1 -0
  34. package/dist/result/result.cjs +170 -0
  35. package/dist/result/result.cjs.map +1 -0
  36. package/dist/result/result.d.cts +28 -0
  37. package/dist/result/result.d.ts +28 -0
  38. package/dist/result/result.js +168 -0
  39. package/dist/result/result.js.map +1 -0
  40. package/dist/types/globals.cjs +4 -0
  41. package/dist/types/globals.cjs.map +1 -0
  42. package/dist/types/globals.d.cts +203 -0
  43. package/dist/types/globals.d.ts +203 -0
  44. package/dist/types/globals.js +3 -0
  45. package/dist/types/globals.js.map +1 -0
  46. package/package.json +2 -2
package/README.md CHANGED
@@ -309,12 +309,13 @@ The `Result` type currently implements the following methods:
309
309
  - [x] `map(fn)`: Maps a successful value using a function.
310
310
  - [x] `flatMap(fn)`: Applies a function that returns a `Result`.
311
311
  - [x] `mapErr(fn)`: Maps an error value using a function.
312
+ - [x] `ok()`: Converts `Result<T, E>` into `Option<T>`.
313
+
312
314
 
313
315
  #### Methods to be Developed
314
316
 
315
317
  The following methods are planned for future development:
316
318
 
317
- - [ ] `expect(message)`: Extracts the successful value or throws an error with a custom message.
318
319
  - [ ] `ok()`: Converts `Result<T, E>` into `Option<T>`.
319
320
  - [ ] `err()`: Converts `Result<T, E>` into `Option<E>`.
320
321
  - [ ] `and(res)`: Returns `Err` if `self` is `Err`, otherwise returns `res`.
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ // src/helpers/match.ts
4
+ function match(matcher, cases) {
5
+ if ("isOk" in matcher && matcher.isOk()) {
6
+ if (!cases.Ok) throw new Error("Missing case for Ok");
7
+ return cases.Ok(matcher.unwrap());
8
+ }
9
+ if ("isErr" in matcher && matcher.isErr()) {
10
+ if (!cases.Err) throw new Error("Missing case for Err");
11
+ return cases.Err(matcher.unwrapErr());
12
+ }
13
+ if ("isSome" in matcher && matcher.isSome()) {
14
+ if (!cases.Some) throw new Error("Missing case for Some");
15
+ return cases.Some(matcher.unwrap());
16
+ }
17
+ if ("isNone" in matcher && matcher.isNone()) {
18
+ if (!cases.None) throw new Error("Missing case for None");
19
+ return cases.None();
20
+ }
21
+ throw new Error("Invalid matcher or missing case");
22
+ }
23
+ global.match = match;
24
+
25
+ exports.match = match;
26
+ //# sourceMappingURL=match.cjs.map
27
+ //# sourceMappingURL=match.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/helpers/match.ts"],"names":[],"mappings":";;;AAiBO,SAAS,KAAA,CACd,SACA,KAMG,EAAA;AACH,EAAA,IAAI,MAAU,IAAA,OAAA,IAAW,OAAQ,CAAA,IAAA,EAAQ,EAAA;AACvC,IAAA,IAAI,CAAC,KAAM,CAAA,EAAA,EAAU,MAAA,IAAI,MAAM,qBAAqB,CAAA;AACpD,IAAA,OAAO,KAAM,CAAA,EAAA,CAAG,OAAQ,CAAA,MAAA,EAAQ,CAAA;AAAA;AAGlC,EAAA,IAAI,OAAW,IAAA,OAAA,IAAW,OAAQ,CAAA,KAAA,EAAS,EAAA;AACzC,IAAA,IAAI,CAAC,KAAM,CAAA,GAAA,EAAW,MAAA,IAAI,MAAM,sBAAsB,CAAA;AACtD,IAAA,OAAO,KAAM,CAAA,GAAA,CAAI,OAAQ,CAAA,SAAA,EAAgB,CAAA;AAAA;AAG3C,EAAA,IAAI,QAAY,IAAA,OAAA,IAAW,OAAQ,CAAA,MAAA,EAAU,EAAA;AAC3C,IAAA,IAAI,CAAC,KAAM,CAAA,IAAA,EAAY,MAAA,IAAI,MAAM,uBAAuB,CAAA;AACxD,IAAA,OAAO,KAAM,CAAA,IAAA,CAAK,OAAQ,CAAA,MAAA,EAAQ,CAAA;AAAA;AAGpC,EAAA,IAAI,QAAY,IAAA,OAAA,IAAW,OAAQ,CAAA,MAAA,EAAU,EAAA;AAC3C,IAAA,IAAI,CAAC,KAAM,CAAA,IAAA,EAAY,MAAA,IAAI,MAAM,uBAAuB,CAAA;AACxD,IAAA,OAAO,MAAM,IAAK,EAAA;AAAA;AAGpB,EAAM,MAAA,IAAI,MAAM,iCAAiC,CAAA;AACnD;AAGC,MAAA,CAAe,KAAQ,GAAA,KAAA","file":"match.cjs","sourcesContent":["import type { Option } from \"../option\";\nimport type { Result } from \"../result\";\n\nexport function match<T, E extends Error, R>(\n matcher: Result<T, E>,\n cases: {\n Ok: (value: T) => R;\n Err: (error: E) => R;\n },\n): R;\nexport function match<T, R>(\n matcher: Option<T>,\n cases: {\n Some: (value: T) => R;\n None: () => R;\n },\n): R;\nexport function match<T, E extends Error, R>(\n matcher: Result<T, E> | Option<T>,\n cases: {\n Ok?: (value: T) => R;\n Err?: (error: E) => R;\n Some?: (value: T) => R;\n None?: () => R;\n },\n): R {\n if (\"isOk\" in matcher && matcher.isOk()) {\n if (!cases.Ok) throw new Error(\"Missing case for Ok\");\n return cases.Ok(matcher.unwrap());\n }\n\n if (\"isErr\" in matcher && matcher.isErr()) {\n if (!cases.Err) throw new Error(\"Missing case for Err\");\n return cases.Err(matcher.unwrapErr() as E);\n }\n\n if (\"isSome\" in matcher && matcher.isSome()) {\n if (!cases.Some) throw new Error(\"Missing case for Some\");\n return cases.Some(matcher.unwrap());\n }\n\n if (\"isNone\" in matcher && matcher.isNone()) {\n if (!cases.None) throw new Error(\"Missing case for None\");\n return cases.None();\n }\n\n throw new Error(\"Invalid matcher or missing case\");\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n(global as any).match = match;\n"]}
@@ -0,0 +1,13 @@
1
+ import { O as Option } from '../option-DpT8KCGE.cjs';
2
+ import { R as Result } from '../types/globals.cjs';
3
+
4
+ declare function match<T, E extends Error, R>(matcher: Result<T, E>, cases: {
5
+ Ok: (value: T) => R;
6
+ Err: (error: E) => R;
7
+ }): R;
8
+ declare function match<T, R>(matcher: Option<T>, cases: {
9
+ Some: (value: T) => R;
10
+ None: () => R;
11
+ }): R;
12
+
13
+ export { match };
@@ -0,0 +1,13 @@
1
+ import { O as Option } from '../option-DpT8KCGE.js';
2
+ import { R as Result } from '../types/globals.js';
3
+
4
+ declare function match<T, E extends Error, R>(matcher: Result<T, E>, cases: {
5
+ Ok: (value: T) => R;
6
+ Err: (error: E) => R;
7
+ }): R;
8
+ declare function match<T, R>(matcher: Option<T>, cases: {
9
+ Some: (value: T) => R;
10
+ None: () => R;
11
+ }): R;
12
+
13
+ export { match };
@@ -0,0 +1,25 @@
1
+ // src/helpers/match.ts
2
+ function match(matcher, cases) {
3
+ if ("isOk" in matcher && matcher.isOk()) {
4
+ if (!cases.Ok) throw new Error("Missing case for Ok");
5
+ return cases.Ok(matcher.unwrap());
6
+ }
7
+ if ("isErr" in matcher && matcher.isErr()) {
8
+ if (!cases.Err) throw new Error("Missing case for Err");
9
+ return cases.Err(matcher.unwrapErr());
10
+ }
11
+ if ("isSome" in matcher && matcher.isSome()) {
12
+ if (!cases.Some) throw new Error("Missing case for Some");
13
+ return cases.Some(matcher.unwrap());
14
+ }
15
+ if ("isNone" in matcher && matcher.isNone()) {
16
+ if (!cases.None) throw new Error("Missing case for None");
17
+ return cases.None();
18
+ }
19
+ throw new Error("Invalid matcher or missing case");
20
+ }
21
+ global.match = match;
22
+
23
+ export { match };
24
+ //# sourceMappingURL=match.js.map
25
+ //# sourceMappingURL=match.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/helpers/match.ts"],"names":[],"mappings":";AAiBO,SAAS,KAAA,CACd,SACA,KAMG,EAAA;AACH,EAAA,IAAI,MAAU,IAAA,OAAA,IAAW,OAAQ,CAAA,IAAA,EAAQ,EAAA;AACvC,IAAA,IAAI,CAAC,KAAM,CAAA,EAAA,EAAU,MAAA,IAAI,MAAM,qBAAqB,CAAA;AACpD,IAAA,OAAO,KAAM,CAAA,EAAA,CAAG,OAAQ,CAAA,MAAA,EAAQ,CAAA;AAAA;AAGlC,EAAA,IAAI,OAAW,IAAA,OAAA,IAAW,OAAQ,CAAA,KAAA,EAAS,EAAA;AACzC,IAAA,IAAI,CAAC,KAAM,CAAA,GAAA,EAAW,MAAA,IAAI,MAAM,sBAAsB,CAAA;AACtD,IAAA,OAAO,KAAM,CAAA,GAAA,CAAI,OAAQ,CAAA,SAAA,EAAgB,CAAA;AAAA;AAG3C,EAAA,IAAI,QAAY,IAAA,OAAA,IAAW,OAAQ,CAAA,MAAA,EAAU,EAAA;AAC3C,IAAA,IAAI,CAAC,KAAM,CAAA,IAAA,EAAY,MAAA,IAAI,MAAM,uBAAuB,CAAA;AACxD,IAAA,OAAO,KAAM,CAAA,IAAA,CAAK,OAAQ,CAAA,MAAA,EAAQ,CAAA;AAAA;AAGpC,EAAA,IAAI,QAAY,IAAA,OAAA,IAAW,OAAQ,CAAA,MAAA,EAAU,EAAA;AAC3C,IAAA,IAAI,CAAC,KAAM,CAAA,IAAA,EAAY,MAAA,IAAI,MAAM,uBAAuB,CAAA;AACxD,IAAA,OAAO,MAAM,IAAK,EAAA;AAAA;AAGpB,EAAM,MAAA,IAAI,MAAM,iCAAiC,CAAA;AACnD;AAGC,MAAA,CAAe,KAAQ,GAAA,KAAA","file":"match.js","sourcesContent":["import type { Option } from \"../option\";\nimport type { Result } from \"../result\";\n\nexport function match<T, E extends Error, R>(\n matcher: Result<T, E>,\n cases: {\n Ok: (value: T) => R;\n Err: (error: E) => R;\n },\n): R;\nexport function match<T, R>(\n matcher: Option<T>,\n cases: {\n Some: (value: T) => R;\n None: () => R;\n },\n): R;\nexport function match<T, E extends Error, R>(\n matcher: Result<T, E> | Option<T>,\n cases: {\n Ok?: (value: T) => R;\n Err?: (error: E) => R;\n Some?: (value: T) => R;\n None?: () => R;\n },\n): R {\n if (\"isOk\" in matcher && matcher.isOk()) {\n if (!cases.Ok) throw new Error(\"Missing case for Ok\");\n return cases.Ok(matcher.unwrap());\n }\n\n if (\"isErr\" in matcher && matcher.isErr()) {\n if (!cases.Err) throw new Error(\"Missing case for Err\");\n return cases.Err(matcher.unwrapErr() as E);\n }\n\n if (\"isSome\" in matcher && matcher.isSome()) {\n if (!cases.Some) throw new Error(\"Missing case for Some\");\n return cases.Some(matcher.unwrap());\n }\n\n if (\"isNone\" in matcher && matcher.isNone()) {\n if (!cases.None) throw new Error(\"Missing case for None\");\n return cases.None();\n }\n\n throw new Error(\"Invalid matcher or missing case\");\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n(global as any).match = match;\n"]}
package/dist/index.cjs ADDED
@@ -0,0 +1,316 @@
1
+ 'use strict';
2
+
3
+ // src/helpers/match.ts
4
+ function match2(matcher, cases) {
5
+ if ("isOk" in matcher && matcher.isOk()) {
6
+ if (!cases.Ok) throw new Error("Missing case for Ok");
7
+ return cases.Ok(matcher.unwrap());
8
+ }
9
+ if ("isErr" in matcher && matcher.isErr()) {
10
+ if (!cases.Err) throw new Error("Missing case for Err");
11
+ return cases.Err(matcher.unwrapErr());
12
+ }
13
+ if ("isSome" in matcher && matcher.isSome()) {
14
+ if (!cases.Some) throw new Error("Missing case for Some");
15
+ return cases.Some(matcher.unwrap());
16
+ }
17
+ if ("isNone" in matcher && matcher.isNone()) {
18
+ if (!cases.None) throw new Error("Missing case for None");
19
+ return cases.None();
20
+ }
21
+ throw new Error("Invalid matcher or missing case");
22
+ }
23
+ global.match = match2;
24
+
25
+ // src/option/__internal__/return-types/some.ts
26
+ var Some2 = class _Some {
27
+ /**
28
+ * Creates a new `Some` option with the given value.
29
+ * @param value The value to be wrapped in the `Some` option.
30
+ */
31
+ constructor(value) {
32
+ this.value = value;
33
+ }
34
+ /**
35
+ * Checks if this option is a `Some`.
36
+ * @returns `true` if this option is a `Some`, otherwise `false`.
37
+ */
38
+ isSome() {
39
+ return true;
40
+ }
41
+ /**
42
+ * Checks if this option is a `None`.
43
+ * @returns `false` because this is a `Some`.
44
+ */
45
+ isNone() {
46
+ return false;
47
+ }
48
+ /**
49
+ * Unwraps the value held by this `Some` option.
50
+ * @returns The value held by this `Some` option.
51
+ */
52
+ unwrap() {
53
+ return this.value;
54
+ }
55
+ /**
56
+ * Applies a transformation function to the value held by this `Some` option and returns a new `Option` with the transformed value.
57
+ * @template U The type of the transformed value.
58
+ * @param fn The transformation function to apply to the value.
59
+ * @returns A new `Some` option containing the transformed value.
60
+ */
61
+ map(fn) {
62
+ return new _Some(fn(this.value));
63
+ }
64
+ /**
65
+ * Applies a transformation function that returns an `Option` to the value held by this `Some` option.
66
+ * @template U The type of the value in the resulting `Option`.
67
+ * @param fn The transformation function to apply to the value.
68
+ * @returns The result of applying the transformation function.
69
+ */
70
+ flatMap(fn) {
71
+ return fn(this.value);
72
+ }
73
+ /**
74
+ * Returns the value held by this `Some` option, ignoring the default value provided.
75
+ * @param _ A default value (ignored in this implementation).
76
+ * @returns The value held by this `Some` option.
77
+ */
78
+ unwrapOr(_) {
79
+ return this.value;
80
+ }
81
+ };
82
+
83
+ // src/option/__internal__/return-types/none.ts
84
+ var None2 = class _None {
85
+ /**
86
+ * Checks if this option is a `Some`.
87
+ * @returns `false` because this is a `None`.
88
+ */
89
+ isSome() {
90
+ return false;
91
+ }
92
+ /**
93
+ * Checks if this option is a `None`.
94
+ * @returns `true` because this is a `None`.
95
+ */
96
+ isNone() {
97
+ return true;
98
+ }
99
+ /**
100
+ * Attempts to unwrap the value from this `None` option.
101
+ * @throws An error because `None` has no value.
102
+ */
103
+ unwrap() {
104
+ throw new Error("Called unwrap on a None value");
105
+ }
106
+ /**
107
+ * Applies a transformation function to the value (which does not exist) of this `None` option.
108
+ * @template U The type of the value that would have been returned.
109
+ * @param _fn The transformation function (ignored in this implementation).
110
+ * @returns A new `None` option.
111
+ */
112
+ map(_fn) {
113
+ return new _None();
114
+ }
115
+ /**
116
+ * Applies a transformation function that returns an `Option` to the value (which does not exist) of this `None` option.
117
+ * @template U The type of the value in the resulting `Option`.
118
+ * @param _fn The transformation function (ignored in this implementation).
119
+ * @returns A new `None` option.
120
+ */
121
+ flatMap(_fn) {
122
+ return new _None();
123
+ }
124
+ /**
125
+ * Returns the default value provided, since `None` has no value.
126
+ * @template T The type of the default value.
127
+ * @param defaultValue The value to return.
128
+ * @returns The default value provided.
129
+ */
130
+ unwrapOr(defaultValue) {
131
+ return defaultValue;
132
+ }
133
+ };
134
+
135
+ // src/option/option.ts
136
+ function Some3(value) {
137
+ return new Some2(value);
138
+ }
139
+ function None3() {
140
+ return new None2();
141
+ }
142
+ global.Some = Some3;
143
+ global.None = None3;
144
+
145
+ // src/result/__internal__/return-types/err.ts
146
+ var Err = class _Err extends Error {
147
+ error;
148
+ /**
149
+ * Creates a new `Err` instance with the given error value.
150
+ * @param error The error to wrap in the `Err` instance.
151
+ */
152
+ constructor(error) {
153
+ super(typeof error === "string" ? error : error.message);
154
+ this.error = typeof error === "string" ? new Error(error) : error;
155
+ Object.setPrototypeOf(this, _Err.prototype);
156
+ if (Error.captureStackTrace) {
157
+ Error.captureStackTrace(this, _Err);
158
+ }
159
+ }
160
+ /**
161
+ * Checks if this result is an `Ok`.
162
+ * @returns `false` because this is an `Err`.
163
+ */
164
+ isOk() {
165
+ return false;
166
+ }
167
+ /**
168
+ * Checks if this result is an `Err`.
169
+ * @returns `true` because this is an `Err`.
170
+ */
171
+ isErr() {
172
+ return true;
173
+ }
174
+ /**
175
+ * Retrieves the value contained in this result. Since this is an `Err`, an error is thrown.
176
+ * @throws An error because `unwrap` is called on an `Err`.
177
+ */
178
+ unwrap() {
179
+ throw new Error("Called unwrap on an Err value");
180
+ }
181
+ /**
182
+ * Maps the value (if any). Since this is an `Err`, the mapping function is ignored, and the original `Err` is returned.
183
+ * @template U The type of the value (ignored for `Err`).
184
+ * @param _fn The mapping function for values (not used).
185
+ * @returns The original `Err` instance.
186
+ */
187
+ map(_fn) {
188
+ return this;
189
+ }
190
+ /**
191
+ * Maps the error value using a transformation function and returns a new `Result` with the transformed error.
192
+ * @template U The type of the transformed error.
193
+ * @param fn The transformation function to apply to the error value.
194
+ * @returns A new `Err` containing the transformed error.
195
+ */
196
+ mapErr(fn) {
197
+ return new _Err(fn(this.error));
198
+ }
199
+ /**
200
+ * Applies a transformation function that returns a `Result` to the value (which does not exist) of this `Err`.
201
+ * @template U The type of the value in the resulting `Result`.
202
+ * @param _fn The transformation function (ignored in this implementation).
203
+ * @returns The original `Err` instance.
204
+ */
205
+ flatMap(_fn) {
206
+ return this;
207
+ }
208
+ /**
209
+ * Retrieves the error value contained in this `Err`.
210
+ * @returns The error value contained in this `Err`.
211
+ */
212
+ unwrapErr() {
213
+ return this.error;
214
+ }
215
+ /**
216
+ * Converts `Result` type to `Option` type.
217
+ * @returns `Some` if the result is `Ok`, `None` if the result is `Err`.
218
+ */
219
+ ok() {
220
+ return None();
221
+ }
222
+ };
223
+
224
+ // src/result/__internal__/return-types/ok.ts
225
+ var Ok = class _Ok {
226
+ /**
227
+ * Creates a new `Ok` instance with the given value.
228
+ * @param value The value to wrap in the `Ok` instance.
229
+ */
230
+ constructor(value) {
231
+ this.value = value;
232
+ }
233
+ /**
234
+ * Checks if this result is an `Ok`.
235
+ * @returns `true` because this is an `Ok`.
236
+ */
237
+ isOk() {
238
+ return true;
239
+ }
240
+ /**
241
+ * Checks if this result is an `Err`.
242
+ * @returns `false` because this is an `Ok`.
243
+ */
244
+ isErr() {
245
+ return false;
246
+ }
247
+ /**
248
+ * Retrieves the value contained in this `Ok`.
249
+ * @returns The value contained in this `Ok`.
250
+ */
251
+ unwrap() {
252
+ return this.value;
253
+ }
254
+ /**
255
+ * Applies a transformation function to the value contained in this `Ok` and returns a new `Result` with the transformed value.
256
+ * @template U The type of the transformed value.
257
+ * @param fn The transformation function to apply to the value.
258
+ * @returns A new `Ok` containing the transformed value.
259
+ */
260
+ map(fn) {
261
+ return new _Ok(fn(this.value));
262
+ }
263
+ /**
264
+ * Applies a transformation function that returns a `Result` to the value contained in this `Ok`.
265
+ * @template U The type of the value in the resulting `Result`.
266
+ * @param fn The transformation function to apply to the value.
267
+ * @returns The result of applying the transformation function.
268
+ */
269
+ flatMap(fn) {
270
+ return fn(this.value);
271
+ }
272
+ /**
273
+ * Maps the error value (if any). Since this is an `Ok`, the error mapping function is ignored, and the original `Ok` is returned.
274
+ * @template U The type of the error (ignored for `Ok`).
275
+ * @param _fn The mapping function for errors (not used).
276
+ * @returns The original `Ok` instance.
277
+ */
278
+ // mapErr<U extends Error | string>(fn: (err: U) => U): Result<T, never> {
279
+ // return this;
280
+ mapErr(_fn) {
281
+ return this;
282
+ }
283
+ /**
284
+ * Retrieves the error contained in this result. Since this is an `Ok`, an error is thrown.
285
+ * @throws An error because `unwrapErr` is called on an `Ok`.
286
+ */
287
+ unwrapErr() {
288
+ throw new Error("Called unwrapErr on an Ok value");
289
+ }
290
+ /**
291
+ * Converts `Result` type to `Option` type.
292
+ * @returns `Some` if the result is `Ok`, `None` if the result is `Err`.
293
+ */
294
+ ok() {
295
+ return match(this, {
296
+ Ok: (v) => Some(v),
297
+ Err: (_) => None()
298
+ });
299
+ }
300
+ };
301
+
302
+ // src/result/result.ts
303
+ function Ok2(value) {
304
+ return new Ok(value);
305
+ }
306
+ function Err2(error) {
307
+ return new Err(error);
308
+ }
309
+ global.Ok = Ok2;
310
+ global.Err = Err2;
311
+
312
+ exports.None = None3;
313
+ exports.Some = Some3;
314
+ exports.match = match2;
315
+ //# sourceMappingURL=index.cjs.map
316
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/helpers/match.ts","../src/option/__internal__/return-types/some.ts","../src/option/__internal__/return-types/none.ts","../src/option/option.ts","../src/result/__internal__/return-types/err.ts","../src/result/__internal__/return-types/ok.ts","../src/result/result.ts"],"names":["match","Some","None","Ok","Err"],"mappings":";;;AAiBO,SAASA,MAAAA,CACd,SACA,KAMG,EAAA;AACH,EAAA,IAAI,MAAU,IAAA,OAAA,IAAW,OAAQ,CAAA,IAAA,EAAQ,EAAA;AACvC,IAAA,IAAI,CAAC,KAAM,CAAA,EAAA,EAAU,MAAA,IAAI,MAAM,qBAAqB,CAAA;AACpD,IAAA,OAAO,KAAM,CAAA,EAAA,CAAG,OAAQ,CAAA,MAAA,EAAQ,CAAA;AAAA;AAGlC,EAAA,IAAI,OAAW,IAAA,OAAA,IAAW,OAAQ,CAAA,KAAA,EAAS,EAAA;AACzC,IAAA,IAAI,CAAC,KAAM,CAAA,GAAA,EAAW,MAAA,IAAI,MAAM,sBAAsB,CAAA;AACtD,IAAA,OAAO,KAAM,CAAA,GAAA,CAAI,OAAQ,CAAA,SAAA,EAAgB,CAAA;AAAA;AAG3C,EAAA,IAAI,QAAY,IAAA,OAAA,IAAW,OAAQ,CAAA,MAAA,EAAU,EAAA;AAC3C,IAAA,IAAI,CAAC,KAA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AAAA,EAMA,MAAY,GAAA;AACV,IAAA,OAAO,IAAK,CAAA,KAAA;AAAA;AACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,IAAO,EAAiD,EAAA;AACtD,IAAA,OAAO,IAAI,GAAA,CAAG,EAAG,CAAA,IAAA,CAAK,KAAK,CAAC,CAAA;AAAA;AAC9B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,QACE,EAC4B,EAAA;AAC5B,IAAO,OAAA,EAAA,CAAG,KAAK,KAAK,CAAA;AAAA;AACtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,OAAwB,GAAgD,EAAA;AACtE,IAAO,OAAA,IAAA;AAAA;AACT;AAAA;AAAA;AAAA;AAAA,EAMA,SAAmB,GAAA;AACjB,IAAM,MAAA,IAAI,MAAM,iCAAiC,CAAA;AAAA;AACnD;AAAA;AAAA;AAAA;AAAA,EAMA,EAAK,GAAA;AACH,IAAA,OAAO,MAAM,IAAM,EAAA;AAAA,MACjB,EAAI,EAAA,CAAC,CAAM,KAAA,IAAA,CAAK,CAAC,CAAA;AAAA,MACjB,GAAA,EAAK,CAAC,CAAA,KAAM,IAAK;AAAA,KAClB,CAAA;AAAA;AAEL,CAAA;;;ACzEA,SAASC,IAAM,KAAqB,EAAA;AAClC,EAAO,OAAA,IAAI,GAAO,KAAK,CAAA;AACzB;AAYA,SAASC,KAAqB,KAA+B,EAAA;AAC3D,EAAO,OAAA,IAAI,IAAQ,KAAK,CAAA;AAC1B;AAGC,MAAA,CAAe,EAAKD,GAAAA,GAAAA;AAEpB,MAAA,CAAe,GAAMC,GAAAA,IAAAA","file":"index.cjs","sourcesContent":["import type { Option } from \"../option\";\nimport type { Result } from \"../result\";\n\nexport function match<T, E extends Error, R>(\n matcher: Result<T, E>,\n cases: {\n Ok: (value: T) => R;\n Err: (error: E) => R;\n },\n): R;\nexport function match<T, R>(\n matcher: Option<T>,\n cases: {\n Some: (value: T) => R;\n None: () => R;\n },\n): R;\nexport function match<T, E extends Error, R>(\n matcher: Result<T, E> | Option<T>,\n cases: {\n Ok?: (value: T) => R;\n Err?: (error: E) => R;\n Some?: (value: T) => R;\n None?: () => R;\n },\n): R {\n if (\"isOk\" in matcher && matcher.isOk()) {\n if (!cases.Ok) throw new Error(\"Missing case for Ok\");\n return cases.Ok(matcher.unwrap());\n }\n\n if (\"isErr\" in matcher && matcher.isErr()) {\n if (!cases.Err) throw new Error(\"Missing case for Err\");\n return cases.Err(matcher.unwrapErr() as E);\n }\n\n if (\"isSome\" in matcher && matcher.isSome()) {\n if (!cases.Some) throw new Error(\"Missing case for Some\");\n return cases.Some(matcher.unwrap());\n }\n\n if (\"isNone\" in matcher && matcher.isNone()) {\n if (!cases.None) throw new Error(\"Missing case for None\");\n return cases.None();\n }\n\n throw new Error(\"Invalid matcher or missing case\");\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n(global as any).match = match;\n","import type { None } from \"./none\";\nimport type { Option } from \"./option\";\n\n/**\n * Represents a `Some` option, which holds a value.\n * @template T The type of the value held by this `Some` instance.\n */\nexport class Some<T> {\n /**\n * Creates a new `Some` option with the given value.\n * @param value The value to be wrapped in the `Some` option.\n */\n constructor(private value: T) { }\n\n /**\n * Checks if this option is a `Some`.\n * @returns `true` if this option is a `Some`, otherwise `false`.\n */\n isSome(): this is Some<T> {\n return true;\n }\n\n /**\n * Checks if this option is a `None`.\n * @returns `false` because this is a `Some`.\n */\n isNone(): this is None {\n return false;\n }\n\n /**\n * Unwraps the value held by this `Some` option.\n * @returns The value held by this `Some` option.\n */\n unwrap(): T {\n return this.value;\n }\n\n /**\n * Applies a transformation function to the value held by this `Some` option and returns a new `Option` with the transformed value.\n * @template U The type of the transformed value.\n * @param fn The transformation function to apply to the value.\n * @returns A new `Some` option containing the transformed value.\n */\n map<U>(fn: (value: T) => U): Option<U> {\n return new Some(fn(this.value));\n }\n\n /**\n * Applies a transformation function that returns an `Option` to the value held by this `Some` option.\n * @template U The type of the value in the resulting `Option`.\n * @param fn The transformation function to apply to the value.\n * @returns The result of applying the transformation function.\n */\n flatMap<U>(fn: (value: T) => Option<U>): Option<U> {\n return fn(this.value);\n }\n\n /**\n * Returns the value held by this `Some` option, ignoring the default value provided.\n * @param _ A default value (ignored in this implementation).\n * @returns The value held by this `Some` option.\n */\n unwrapOr(_: T): T {\n return this.value;\n }\n}\n","import type { Some } from \"./some\";\nimport type { Option } from \"./option\";\n\n/**\n * Represents a `None` option, which holds no value.\n */\nexport class None {\n /**\n * Checks if this option is a `Some`.\n * @returns `false` because this is a `None`.\n */\n isSome(): this is Some<never> {\n return false;\n }\n\n /**\n * Checks if this option is a `None`.\n * @returns `true` because this is a `None`.\n */\n isNone(): this is None {\n return true;\n }\n\n /**\n * Attempts to unwrap the value from this `None` option.\n * @throws An error because `None` has no value.\n */\n unwrap(): never {\n throw new Error(\"Called unwrap on a None value\");\n }\n\n /**\n * Applies a transformation function to the value (which does not exist) of this `None` option.\n * @template U The type of the value that would have been returned.\n * @param _fn The transformation function (ignored in this implementation).\n * @returns A new `None` option.\n */\n map<U>(_fn: (value: never) => U): Option<U> {\n return new None();\n }\n\n /**\n * Applies a transformation function that returns an `Option` to the value (which does not exist) of this `None` option.\n * @template U The type of the value in the resulting `Option`.\n * @param _fn The transformation function (ignored in this implementation).\n * @returns A new `None` option.\n */\n flatMap<U>(_fn: (value: never) => Option<U>): Option<U> {\n return new None();\n }\n\n /**\n * Returns the default value provided, since `None` has no value.\n * @template T The type of the default value.\n * @param defaultValue The value to return.\n * @returns The default value provided.\n */\n unwrapOr<T>(defaultValue: T): T {\n return defaultValue;\n }\n}\n","import {\n\tSome as SomeType,\n\tNone as NoneType,\n\ttype Option,\n} from \"./__internal__/return-types\";\n\n/**\n * Creates a new `Some` instance, representing an `Option` with a value.\n * @template T The type of the value contained in the `Some`.\n * @param value The value to wrap in the `Some` instance.\n * @returns A `Some` instance containing the given value.\n * @example\n * const option = Some(42);\n * console.log(option.isSome()); // true\n * console.log(option.unwrap()); // 42\n */\nfunction Some<T>(value: T): SomeType<T> {\n\treturn new SomeType(value);\n}\n\n/**\n * Creates a new `None` instance, representing an `Option` with no value.\n * @returns A `None` instance.\n * @example\n * const option = None();\n * console.log(option.isNone()); // true\n * console.log(option.unwrap()); // throws Error: \"Called unwrap on a None value\"\n */\nfunction None(): NoneType {\n\treturn new NoneType();\n}\n\n(global as any).Some = Some;\n(global as any).None = None;\n\nexport { None, Some, Option };\n","import type { Ok } from \"./ok\";\nimport type { ResultDefinition } from \"./result\";\n\n/**\n * Represents a failed result (`Err`) that contains an error value.\n * @template E The type of the error contained in this `Err`.\n */\nexport class Err<E extends Error>\n extends Error\n implements ResultDefinition<never, E>\n{\n private error: E;\n /**\n * Creates a new `Err` instance with the given error value.\n * @param error The error to wrap in the `Err` instance.\n */\n constructor(error: E | string) {\n super(typeof error === \"string\" ? error : error.message);\n this.error =\n typeof error === \"string\" ? (new Error(error) as E) : (error as E);\n Object.setPrototypeOf(this, Err.prototype);\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, Err);\n }\n }\n\n /**\n * Checks if this result is an `Ok`.\n * @returns `false` because this is an `Err`.\n */\n isOk(): this is Ok<never> {\n return false;\n }\n\n /**\n * Checks if this result is an `Err`.\n * @returns `true` because this is an `Err`.\n */\n isErr(): this is Err<E extends Error ? E : Error> {\n return true;\n }\n\n /**\n * Retrieves the value contained in this result. Since this is an `Err`, an error is thrown.\n * @throws An error because `unwrap` is called on an `Err`.\n */\n unwrap(): never {\n throw new Error(\"Called unwrap on an Err value\");\n }\n\n /**\n * Maps the value (if any). Since this is an `Err`, the mapping function is ignored, and the original `Err` is returned.\n * @template U The type of the value (ignored for `Err`).\n * @param _fn The mapping function for values (not used).\n * @returns The original `Err` instance.\n */\n map<U>(_fn: (value: never) => U): ResultDefinition<never, E> {\n return this as unknown as ResultDefinition<never, E>;\n }\n\n /**\n * Maps the error value using a transformation function and returns a new `Result` with the transformed error.\n * @template U The type of the transformed error.\n * @param fn The transformation function to apply to the error value.\n * @returns A new `Err` containing the transformed error.\n */\n mapErr<U extends Error>(fn: (err: E) => U): ResultDefinition<never, U> {\n return new Err<U>(fn(this.error)) as unknown as ResultDefinition<never, U>;\n }\n\n /**\n * Applies a transformation function that returns a `Result` to the value (which does not exist) of this `Err`.\n * @template U The type of the value in the resulting `Result`.\n * @param _fn The transformation function (ignored in this implementation).\n * @returns The original `Err` instance.\n */\n flatMap<U>(\n _fn: (value: never) => ResultDefinition<U, never>,\n ): ResultDefinition<never, E> {\n return this as unknown as ResultDefinition<never, E>;\n }\n\n /**\n * Retrieves the error value contained in this `Err`.\n * @returns The error value contained in this `Err`.\n */\n unwrapErr(): E {\n return this.error;\n }\n\n /**\n * Converts `Result` type to `Option` type.\n * @returns `Some` if the result is `Ok`, `None` if the result is `Err`.\n */\n ok() {\n return None();\n }\n}\n","import type { ResultDefinition } from \"./result\";\nimport type { Err } from \"./err\";\n\n/**\n * Represents a successful result (`Ok`) that contains a value.\n * @template T The type of the value contained in this `Ok`.\n */\nexport class Ok<T> implements ResultDefinition<T, never> {\n /**\n * Creates a new `Ok` instance with the given value.\n * @param value The value to wrap in the `Ok` instance.\n */\n constructor(private value: T) {}\n /**\n * Checks if this result is an `Ok`.\n * @returns `true` because this is an `Ok`.\n */\n isOk(): this is Ok<T> {\n return true;\n }\n\n /**\n * Checks if this result is an `Err`.\n * @returns `false` because this is an `Ok`.\n */\n isErr(): this is Err<never> {\n return false;\n }\n\n /**\n * Retrieves the value contained in this `Ok`.\n * @returns The value contained in this `Ok`.\n */\n unwrap(): T {\n return this.value;\n }\n\n /**\n * Applies a transformation function to the value contained in this `Ok` and returns a new `Result` with the transformed value.\n * @template U The type of the transformed value.\n * @param fn The transformation function to apply to the value.\n * @returns A new `Ok` containing the transformed value.\n */\n map<U>(fn: (value: T) => U): ResultDefinition<U, never> {\n return new Ok(fn(this.value)) as ResultDefinition<U, never>;\n }\n\n /**\n * Applies a transformation function that returns a `Result` to the value contained in this `Ok`.\n * @template U The type of the value in the resulting `Result`.\n * @param fn The transformation function to apply to the value.\n * @returns The result of applying the transformation function.\n */\n flatMap<U>(\n fn: (value: T) => ResultDefinition<U, never>,\n ): ResultDefinition<U, never> {\n return fn(this.value);\n }\n\n /**\n * Maps the error value (if any). Since this is an `Ok`, the error mapping function is ignored, and the original `Ok` is returned.\n * @template U The type of the error (ignored for `Ok`).\n * @param _fn The mapping function for errors (not used).\n * @returns The original `Ok` instance.\n */\n // mapErr<U extends Error | string>(fn: (err: U) => U): Result<T, never> {\n // \treturn this;\n mapErr<U extends Error>(_fn: (err: never) => U): ResultDefinition<T, U> {\n return this as unknown as ResultDefinition<T, U>;\n }\n\n /**\n * Retrieves the error contained in this result. Since this is an `Ok`, an error is thrown.\n * @throws An error because `unwrapErr` is called on an `Ok`.\n */\n unwrapErr(): never {\n throw new Error(\"Called unwrapErr on an Ok value\");\n }\n\n /**\n * Converts `Result` type to `Option` type.\n * @returns `Some` if the result is `Ok`, `None` if the result is `Err`.\n */\n ok() {\n return match(this, {\n Ok: (v) => Some(v),\n Err: (_) => None(),\n });\n }\n}\n","import {\n Err as ErrType,\n Ok as OkType,\n type Result,\n} from \"./__internal__/return-types\";\n\n/**\n * Creates a new `Ok` instance, representing a successful result.\n * @template T The type of the value contained in the `Ok`.\n * @param value The value to wrap in the `Ok` instance.\n * @returns An `Ok` instance containing the given value.\n * @example\n * const result = Ok(42);\n * console.log(result.isOk()); // true\n * console.log(result.unwrap()); // 42\n */\nfunction Ok<T>(value: T): OkType<T> {\n return new OkType(value);\n}\n\n/**\n * Creates a new `Err` instance, representing a failed result.\n * @template E The type of the error contained in the `Err`.\n * @param error The error to wrap in the `Err` instance.\n * @returns An `Err` instance containing the given error.\n * @example\n * const result = Err(\"Something went wrong\");\n * console.log(result.isErr()); // true\n * console.log(result.unwrapErr()); // \"Something went wrong\"\n */\nfunction Err<E extends Error>(error: E | string): ErrType<E> {\n return new ErrType(error);\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n(global as any).Ok = Ok;\n// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n(global as any).Err = Err;\n\nexport type { Err, Ok, Result, ErrType, OkType };\n"]}
@@ -0,0 +1,5 @@
1
+ export { R as Result } from './types/globals.cjs';
2
+ export { match } from './helpers/match.cjs';
3
+ export { None, Some } from './option/option.cjs';
4
+ export { Err, Ok } from './result/result.cjs';
5
+ export { O as Option } from './option-DpT8KCGE.cjs';
@@ -0,0 +1,5 @@
1
+ export { R as Result } from './types/globals.js';
2
+ export { match } from './helpers/match.js';
3
+ export { None, Some } from './option/option.js';
4
+ export { Err, Ok } from './result/result.js';
5
+ export { O as Option } from './option-DpT8KCGE.js';