happy-rusty 1.2.0 → 1.3.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.
package/dist/types.d.ts CHANGED
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Symbol for Option kind: `Some` or `None`.
3
+ */
4
+ declare const OptionKindSymbol: unique symbol;
5
+ /**
6
+ * Symbol for Result kind: `Ok` or `Err`.
7
+ */
8
+ declare const ResultKindSymbol: unique symbol;
9
+
1
10
  /**
2
11
  * @fileoverview
3
12
  * A Rust-inspired [Option](https://doc.rust-lang.org/core/option/index.html) enum type, used as an alternative to the use of null and undefined.
@@ -5,14 +14,7 @@
5
14
  * And [Result](https://doc.rust-lang.org/core/result/index.html) enum type, used for better error handling.
6
15
  *
7
16
  */
8
- /**
9
- * Symbol for Option kind: `Some` or `None`.
10
- */
11
- declare const optionKindSymbol: unique symbol;
12
- /**
13
- * Symbol for Result kind: `Ok` or `Err`.
14
- */
15
- declare const resultKindSymbol: unique symbol;
17
+
16
18
  /**
17
19
  * Type `Option` represents an optional value: every `Option` is either `Some` and contains a value, or `None`, and does not.
18
20
  * This interface includes methods that act on the `Option` type, similar to Rust's `Option` enum.
@@ -36,7 +38,7 @@ interface Option<T> {
36
38
  *
37
39
  * @private
38
40
  */
39
- readonly [optionKindSymbol]: 'Some' | 'None';
41
+ readonly [OptionKindSymbol]: 'Some' | 'None';
40
42
  /**
41
43
  * The `isSome` and `isNone` methods return `true` if the `Option` is `Some` or `None`, respectively.
42
44
  */
@@ -252,7 +254,7 @@ interface Result<T, E> {
252
254
  *
253
255
  * @private
254
256
  */
255
- readonly [resultKindSymbol]: 'Ok' | 'Err';
257
+ readonly [ResultKindSymbol]: 'Ok' | 'Err';
256
258
  /**
257
259
  * The `isOk` and `isErr` methods return `true` if the `Result` is `Ok` or `Err`, respectively.
258
260
  */
@@ -453,9 +455,30 @@ interface Result<T, E> {
453
455
  */
454
456
  toString(): string;
455
457
  }
458
+
459
+ /**
460
+ * Exports some Result constants.
461
+ */
456
462
  /**
457
- * Export some commonly used types.
463
+ * Result constant for `true`.
464
+ * Can be used anywhere due to immutability.
458
465
  */
466
+ declare const RESULT_TRUE: Result<boolean, any>;
467
+ /**
468
+ * Result constant for `false`.
469
+ * Can be used anywhere due to immutability.
470
+ */
471
+ declare const RESULT_FALSE: Result<boolean, any>;
472
+ /**
473
+ * Result constant for `0`.
474
+ * Can be used anywhere due to immutability.
475
+ */
476
+ declare const RESULT_ZERO: Result<number, any>;
477
+
478
+ /**
479
+ * Exports some commonly used types.
480
+ */
481
+
459
482
  /**
460
483
  * Represents an asynchronous operation that yields an `Option<T>`.
461
484
  * This is a promise that resolves to either `Some(T)` if the value is present, or `None` if the value is absent.
@@ -484,7 +507,49 @@ type IOResult<T> = Result<T, Error>;
484
507
  *
485
508
  * @typeParam T - The type of the value that is produced by a successful I/O operation.
486
509
  */
487
- type AsyncIOResult<T> = Promise<IOResult<T>>;
510
+ type AsyncIOResult<T> = AsyncResult<T, Error>;
511
+
512
+ /**
513
+ * Converts a Promise to a Result type, capturing the resolved value in an `Ok`, or the error in an `Err`.
514
+ * This allows for promise-based asynchronous operations to be handled in a way that is more in line with the Result pattern.
515
+ *
516
+ * @typeParam T - The type of the value that the promise resolves to.
517
+ * @typeParam E - The type of the error that the promise may reject with, defaults to `Error`.
518
+ * @param p - The promise to convert into a `Result` type.
519
+ * @returns A promise that resolves to a `Result<T, E>`. If the input promise `p` resolves, the resulting promise will resolve with `Ok<T>`. If the input promise `p` rejects, the resulting promise will resolve with `Err<E>`.
520
+ *
521
+ * @example
522
+ * ```ts
523
+ * async function example() {
524
+ * const result = await promiseToAsyncResult(fetchData());
525
+ * if (result.isOk()) {
526
+ * console.log('Data:', result.unwrap());
527
+ * } else {
528
+ * console.error('Error:', result.unwrapErr());
529
+ * }
530
+ * }
531
+ * ```
532
+ */
533
+ declare function promiseToAsyncResult<T, E = Error>(p: Promise<T>): Promise<Result<T, E>>;
534
+
535
+ /**
536
+ * Checks if a value is an `Option`.
537
+ *
538
+ * @typeParam T - The expected type of the value contained within the `Option`.
539
+ * @param o - The value to be checked as an `Option`.
540
+ * @returns `true` if the value is an `Option`, otherwise `false`.
541
+ */
542
+ declare function isOption<T>(o: unknown): o is Option<T>;
543
+ /**
544
+ * Checks if a value is a `Result`.
545
+ *
546
+ * @typeParam T - The expected type of the success value contained within the `Result`.
547
+ * @typeParam E - The expected type of the error value contained within the `Result`.
548
+ * @param r - The value to be checked as a `Result`.
549
+ * @returns `true` if the value is a `Result`, otherwise `false`.
550
+ */
551
+ declare function isResult<T, E>(r: unknown): r is Result<T, E>;
552
+
488
553
  /**
489
554
  * Creates an `Option<T>` representing the presence of a value.
490
555
  * This function is typically used to construct an `Option` that contains a value, indicating that the operation yielding the value was successful.
@@ -510,7 +575,7 @@ interface None extends Option<never> {
510
575
  /**
511
576
  * When using `None` alone, the following overrides can make type inference more accurate.
512
577
  */
513
- readonly [optionKindSymbol]: 'None';
578
+ readonly [OptionKindSymbol]: 'None';
514
579
  unwrapOr<T>(defaultValue: T): T;
515
580
  unwrapOrElse<T>(fn: () => T): T;
516
581
  transpose(): Result<None, never>;
@@ -568,45 +633,6 @@ declare function Ok<T, E>(value: T): Result<T, E>;
568
633
  * ```
569
634
  */
570
635
  declare function Err<T, E>(error: E): Result<T, E>;
571
- /**
572
- * Converts a Promise to a Result type, capturing the resolved value in an `Ok`, or the error in an `Err`.
573
- * This allows for promise-based asynchronous operations to be handled in a way that is more in line with the Result pattern.
574
- *
575
- * @typeParam T - The type of the value that the promise resolves to.
576
- * @typeParam E - The type of the error that the promise may reject with, defaults to `Error`.
577
- * @param p - The promise to convert into a `Result` type.
578
- * @returns A promise that resolves to a `Result<T, E>`. If the input promise `p` resolves, the resulting promise will resolve with `Ok<T>`. If the input promise `p` rejects, the resulting promise will resolve with `Err<E>`.
579
- *
580
- * @example
581
- * ```ts
582
- * async function example() {
583
- * const result = await promiseToResult(fetchData());
584
- * if (result.isOk()) {
585
- * console.log('Data:', result.unwrap());
586
- * } else {
587
- * console.error('Error:', result.unwrapErr());
588
- * }
589
- * }
590
- * ```
591
- */
592
- declare function promiseToResult<T, E = Error>(p: Promise<T>): Promise<Result<T, E>>;
593
- /**
594
- * Checks if a value is an `Option`.
595
- *
596
- * @typeParam T - The expected type of the value contained within the `Option`.
597
- * @param o - The value to be checked as an `Option`.
598
- * @returns `true` if the value is an `Option`, otherwise `false`.
599
- */
600
- declare function isOption<T>(o: unknown): o is Option<T>;
601
- /**
602
- * Checks if a value is a `Result`.
603
- *
604
- * @typeParam T - The expected type of the success value contained within the `Result`.
605
- * @typeParam E - The expected type of the error value contained within the `Result`.
606
- * @param r - The value to be checked as a `Result`.
607
- * @returns `true` if the value is a `Result`, otherwise `false`.
608
- */
609
- declare function isResult<T, E>(r: unknown): r is Result<T, E>;
610
636
 
611
- export { type AsyncIOResult, type AsyncOption, type AsyncResult, Err, type IOResult, None, Ok, type Option, type Result, Some, isOption, isResult, promiseToResult };
637
+ export { type AsyncIOResult, type AsyncOption, type AsyncResult, Err, type IOResult, None, Ok, type Option, RESULT_FALSE, RESULT_TRUE, RESULT_ZERO, type Result, Some, isOption, isResult, promiseToAsyncResult };
612
638
  //# sourceMappingURL=types.d.ts.map
package/docs/README.md CHANGED
@@ -26,6 +26,9 @@
26
26
  | Variable | Description |
27
27
  | ------ | ------ |
28
28
  | [None](variables/None.md) | A constant representing the `None` case of an `Option`, indicating the absence of a value. This constant is frozen to ensure it is immutable and cannot be altered, preserving the integrity of `None` throughout the application. |
29
+ | [RESULT\_FALSE](variables/RESULT_FALSE.md) | Result constant for `false`. Can be used anywhere due to immutability. |
30
+ | [RESULT\_TRUE](variables/RESULT_TRUE.md) | Result constant for `true`. Can be used anywhere due to immutability. |
31
+ | [RESULT\_ZERO](variables/RESULT_ZERO.md) | Result constant for `0`. Can be used anywhere due to immutability. |
29
32
 
30
33
  ## Functions
31
34
 
@@ -36,4 +39,4 @@
36
39
  | [Some](functions/Some.md) | Creates an `Option<T>` representing the presence of a value. This function is typically used to construct an `Option` that contains a value, indicating that the operation yielding the value was successful. |
37
40
  | [isOption](functions/isOption.md) | Checks if a value is an `Option`. |
38
41
  | [isResult](functions/isResult.md) | Checks if a value is a `Result`. |
39
- | [promiseToResult](functions/promiseToResult.md) | Converts a Promise to a Result type, capturing the resolved value in an `Ok`, or the error in an `Err`. This allows for promise-based asynchronous operations to be handled in a way that is more in line with the Result pattern. |
42
+ | [promiseToAsyncResult](functions/promiseToAsyncResult.md) | Converts a Promise to a Result type, capturing the resolved value in an `Ok`, or the error in an `Err`. This allows for promise-based asynchronous operations to be handled in a way that is more in line with the Result pattern. |
@@ -43,4 +43,4 @@ if (badResult.isErr()) {
43
43
 
44
44
  ## Defined in
45
45
 
46
- [prelude.ts:1024](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L1024)
46
+ [prelude.ts:413](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/prelude.ts#L413)
@@ -43,4 +43,4 @@ if (goodResult.isOk()) {
43
43
 
44
44
  ## Defined in
45
45
 
46
- [prelude.ts:897](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L897)
46
+ [prelude.ts:286](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/prelude.ts#L286)
@@ -42,4 +42,4 @@ if (maybeValue.isSome()) {
42
42
 
43
43
  ## Defined in
44
44
 
45
- [prelude.ts:666](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L666)
45
+ [prelude.ts:55](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/prelude.ts#L55)
@@ -32,4 +32,4 @@ Checks if a value is an `Option`.
32
32
 
33
33
  ## Defined in
34
34
 
35
- [prelude.ts:1193](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L1193)
35
+ [helpers.ts:11](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/helpers.ts#L11)
@@ -33,4 +33,4 @@ Checks if a value is a `Result`.
33
33
 
34
34
  ## Defined in
35
35
 
36
- [prelude.ts:1206](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L1206)
36
+ [helpers.ts:24](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/helpers.ts#L24)
@@ -2,12 +2,12 @@
2
2
 
3
3
  ***
4
4
 
5
- [happy-rusty](../README.md) / promiseToResult
5
+ [happy-rusty](../README.md) / promiseToAsyncResult
6
6
 
7
- # Function: promiseToResult()
7
+ # Function: promiseToAsyncResult()
8
8
 
9
9
  ```ts
10
- function promiseToResult<T, E>(p): Promise<Result<T, E>>
10
+ function promiseToAsyncResult<T, E>(p): Promise<Result<T, E>>
11
11
  ```
12
12
 
13
13
  Converts a Promise to a Result type, capturing the resolved value in an `Ok`, or the error in an `Err`.
@@ -36,7 +36,7 @@ A promise that resolves to a `Result<T, E>`. If the input promise `p` resolves,
36
36
 
37
37
  ```ts
38
38
  async function example() {
39
- const result = await promiseToResult(fetchData());
39
+ const result = await promiseToAsyncResult(fetchData());
40
40
  if (result.isOk()) {
41
41
  console.log('Data:', result.unwrap());
42
42
  } else {
@@ -47,4 +47,4 @@ async function example() {
47
47
 
48
48
  ## Defined in
49
49
 
50
- [prelude.ts:1178](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L1178)
50
+ [extensions.ts:25](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/extensions.ts#L25)
@@ -17,8 +17,8 @@ The type parameter is set to `never` because `None` does not hold a value.
17
17
 
18
18
  | Property | Modifier | Type | Description | Overrides | Inherited from | Defined in |
19
19
  | ------ | ------ | ------ | ------ | ------ | ------ | ------ |
20
- | `[optionKindSymbol]` | `readonly` | `"None"` | When using `None` alone, the following overrides can make type inference more accurate. | `Option.[optionKindSymbol]` | - | [prelude.ts:301](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L301) |
21
- | `[toStringTag]` | `public` | `"Option"` | [object Option]. | - | [`Option`](Option.md).`[toStringTag]` | [prelude.ts:39](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L39) |
20
+ | `[OptionKindSymbol]` | `readonly` | `"None"` | When using `None` alone, the following overrides can make type inference more accurate. | `Option.[OptionKindSymbol]` | - | [prelude.ts:15](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/prelude.ts#L15) |
21
+ | `[toStringTag]` | `public` | `"Option"` | [object Option]. | - | [`Option`](Option.md).`[toStringTag]` | [core.ts:30](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/core.ts#L30) |
22
22
 
23
23
  ## Methods
24
24
 
@@ -55,7 +55,7 @@ This is sometimes called "and then" because it is similar to a logical AND opera
55
55
 
56
56
  #### Defined in
57
57
 
58
- [prelude.ts:316](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L316)
58
+ [prelude.ts:30](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/prelude.ts#L30)
59
59
 
60
60
  ***
61
61
 
@@ -92,7 +92,7 @@ The result of `fn` if `this` is `Some`, otherwise `None`.
92
92
 
93
93
  #### Defined in
94
94
 
95
- [prelude.ts:317](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L317)
95
+ [prelude.ts:31](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/prelude.ts#L31)
96
96
 
97
97
  ***
98
98
 
@@ -129,7 +129,7 @@ This method can be used for comparing `Option` instances in a value-sensitive ma
129
129
 
130
130
  #### Defined in
131
131
 
132
- [prelude.ts:322](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L322)
132
+ [prelude.ts:36](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/prelude.ts#L36)
133
133
 
134
134
  ***
135
135
 
@@ -161,7 +161,7 @@ Throws an error with the provided message if the Option is a `None`.
161
161
 
162
162
  #### Defined in
163
163
 
164
- [prelude.ts:85](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L85)
164
+ [core.ts:76](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/core.ts#L76)
165
165
 
166
166
  ***
167
167
 
@@ -191,7 +191,7 @@ Returns `None` if the Option is `None`, otherwise calls predicate with the wrapp
191
191
 
192
192
  #### Defined in
193
193
 
194
- [prelude.ts:308](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L308)
194
+ [prelude.ts:22](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/prelude.ts#L22)
195
195
 
196
196
  ***
197
197
 
@@ -215,7 +215,7 @@ Converts from `Option<Option<T>>` to `Option<T>`.
215
215
 
216
216
  #### Defined in
217
217
 
218
- [prelude.ts:309](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L309)
218
+ [prelude.ts:23](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/prelude.ts#L23)
219
219
 
220
220
  ***
221
221
 
@@ -246,7 +246,7 @@ This is primarily for side effects and does not transform the `Option`.
246
246
 
247
247
  #### Defined in
248
248
 
249
- [prelude.ts:272](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L272)
249
+ [core.ts:263](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/core.ts#L263)
250
250
 
251
251
  ***
252
252
 
@@ -268,7 +268,7 @@ Returns `true` if the Option is a `None` value.
268
268
 
269
269
  #### Defined in
270
270
 
271
- [prelude.ts:64](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L64)
271
+ [core.ts:55](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/core.ts#L55)
272
272
 
273
273
  ***
274
274
 
@@ -290,7 +290,7 @@ Returns `true` if the Option is a `Some` value.
290
290
 
291
291
  #### Defined in
292
292
 
293
- [prelude.ts:59](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L59)
293
+ [core.ts:50](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/core.ts#L50)
294
294
 
295
295
  ***
296
296
 
@@ -318,7 +318,7 @@ Returns `true` if the Option is a `Some` value and the predicate returns `true`
318
318
 
319
319
  #### Defined in
320
320
 
321
- [prelude.ts:70](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L70)
321
+ [core.ts:61](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/core.ts#L61)
322
322
 
323
323
  ***
324
324
 
@@ -352,7 +352,7 @@ Maps an `Option<T>` to `Option<U>` by applying a function to a contained value.
352
352
 
353
353
  #### Defined in
354
354
 
355
- [prelude.ts:310](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L310)
355
+ [prelude.ts:24](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/prelude.ts#L24)
356
356
 
357
357
  ***
358
358
 
@@ -387,7 +387,7 @@ Maps an `Option<T>` to `U` by applying a function to the contained value (if any
387
387
 
388
388
  #### Defined in
389
389
 
390
- [prelude.ts:168](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L168)
390
+ [core.ts:159](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/core.ts#L159)
391
391
 
392
392
  ***
393
393
 
@@ -422,7 +422,7 @@ Maps an `Option<T>` to `U` by applying a function to a contained value (if any),
422
422
 
423
423
  #### Defined in
424
424
 
425
- [prelude.ts:176](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L176)
425
+ [core.ts:167](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/core.ts#L167)
426
426
 
427
427
  ***
428
428
 
@@ -456,7 +456,7 @@ Transforms the `Option<T>` into a `Result<T, E>`, mapping `Some(v)` to `Ok(v)` a
456
456
 
457
457
  #### Defined in
458
458
 
459
- [prelude.ts:118](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L118)
459
+ [core.ts:109](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/core.ts#L109)
460
460
 
461
461
  ***
462
462
 
@@ -490,7 +490,7 @@ Transforms the `Option<T>` into a `Result<T, E>`, mapping `Some(v)` to `Ok(v)` a
490
490
 
491
491
  #### Defined in
492
492
 
493
- [prelude.ts:125](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L125)
493
+ [core.ts:116](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/core.ts#L116)
494
494
 
495
495
  ***
496
496
 
@@ -527,7 +527,7 @@ This can be used for providing a fallback `Option`.
527
527
 
528
528
  #### Defined in
529
529
 
530
- [prelude.ts:318](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L318)
530
+ [prelude.ts:32](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/prelude.ts#L32)
531
531
 
532
532
  ***
533
533
 
@@ -564,7 +564,7 @@ This method can be used for lazy fallbacks, as `fn` is only evaluated if `this`
564
564
 
565
565
  #### Defined in
566
566
 
567
- [prelude.ts:319](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L319)
567
+ [prelude.ts:33](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/prelude.ts#L33)
568
568
 
569
569
  ***
570
570
 
@@ -586,7 +586,7 @@ Custom `toString` implementation that uses the `Option`'s contained value.
586
586
 
587
587
  #### Defined in
588
588
 
589
- [prelude.ts:289](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L289)
589
+ [core.ts:280](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/core.ts#L280)
590
590
 
591
591
  ***
592
592
 
@@ -612,7 +612,7 @@ Transposes an `Option` of a `Result` into a `Result` of an `Option`.
612
612
 
613
613
  #### Defined in
614
614
 
615
- [prelude.ts:306](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L306)
615
+ [prelude.ts:20](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/prelude.ts#L20)
616
616
 
617
617
  ***
618
618
 
@@ -638,7 +638,7 @@ Throws an error if the value is a `None`.
638
638
 
639
639
  #### Defined in
640
640
 
641
- [prelude.ts:91](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L91)
641
+ [core.ts:82](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/core.ts#L82)
642
642
 
643
643
  ***
644
644
 
@@ -672,7 +672,7 @@ Returns the contained `Some` value or a provided default.
672
672
 
673
673
  #### Defined in
674
674
 
675
- [prelude.ts:303](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L303)
675
+ [prelude.ts:17](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/prelude.ts#L17)
676
676
 
677
677
  ***
678
678
 
@@ -706,7 +706,7 @@ Returns the contained `Some` value or computes it from a closure.
706
706
 
707
707
  #### Defined in
708
708
 
709
- [prelude.ts:304](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L304)
709
+ [prelude.ts:18](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/prelude.ts#L18)
710
710
 
711
711
  ***
712
712
 
@@ -732,7 +732,7 @@ A tuple of `Options`, one for each element in the original `Option` of a tuple.
732
732
 
733
733
  #### Defined in
734
734
 
735
- [prelude.ts:314](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L314)
735
+ [prelude.ts:28](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/prelude.ts#L28)
736
736
 
737
737
  ***
738
738
 
@@ -769,7 +769,7 @@ This can be thought of as an exclusive or operation on `Option` values.
769
769
 
770
770
  #### Defined in
771
771
 
772
- [prelude.ts:320](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L320)
772
+ [prelude.ts:34](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/prelude.ts#L34)
773
773
 
774
774
  ***
775
775
 
@@ -807,7 +807,7 @@ An `Option` containing a tuple of the values if both are `Some`, otherwise `None
807
807
 
808
808
  #### Defined in
809
809
 
810
- [prelude.ts:312](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L312)
810
+ [prelude.ts:26](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/prelude.ts#L26)
811
811
 
812
812
  ***
813
813
 
@@ -847,4 +847,4 @@ An `Option` containing the result of `fn` if both `Options` are `Some`, otherwis
847
847
 
848
848
  #### Defined in
849
849
 
850
- [prelude.ts:313](https://github.com/JiangJie/happy-rusty/blob/28ebaeb1ee8fded97e00cb58a36e776fbc44e585/src/enum/prelude.ts#L313)
850
+ [prelude.ts:27](https://github.com/JiangJie/happy-rusty/blob/568a73f526d9ce3608e5c5e0ed80e93107bc6adb/src/enum/prelude.ts#L27)