happy-rusty 1.0.9 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,827 @@
1
+ [**happy-rusty**](../index.md) • **Docs**
2
+
3
+ ***
4
+
5
+ [happy-rusty](../index.md) / None
6
+
7
+ # Interface: None
8
+
9
+ Represents the absence of a value, as a specialized `Option` type.
10
+ The type parameter is set to `never` because `None` does not hold a value.
11
+
12
+ ## Extends
13
+
14
+ - [`Option`](Option.md)\<`never`\>
15
+
16
+ ## Properties
17
+
18
+ | Property | Modifier | Type | Description | Overrides |
19
+ | :------ | :------ | :------ | :------ | :------ |
20
+ | `[optionKindSymbol]` | `readonly` | `"None"` | When using `None` alone, the following overrides can make type inference more accurate. | [`Option`](Option.md).`[optionKindSymbol]` |
21
+
22
+ ## Methods
23
+
24
+ ### and()
25
+
26
+ ```ts
27
+ and<U>(other): None
28
+ ```
29
+
30
+ Returns `None` if the Option is `None`, otherwise returns `other`.
31
+ This is sometimes called "and then" because it is similar to a logical AND operation.
32
+
33
+ #### Type parameters
34
+
35
+ | Type parameter | Description |
36
+ | :------ | :------ |
37
+ | `U` | The type of the value in the other `Option`. |
38
+
39
+ #### Parameters
40
+
41
+ | Parameter | Type | Description |
42
+ | :------ | :------ | :------ |
43
+ | `other` | [`Option`](Option.md)\<`U`\> | The `Option` to return if `this` is `Some`. |
44
+
45
+ #### Returns
46
+
47
+ [`None`](None.md)
48
+
49
+ `None` if `this` is `None`, otherwise returns `other`.
50
+
51
+ #### Overrides
52
+
53
+ [`Option`](Option.md).[`and`](Option.md#and)
54
+
55
+ #### Source
56
+
57
+ [enum/prelude.ts:308](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L308)
58
+
59
+ ***
60
+
61
+ ### andThen()
62
+
63
+ ```ts
64
+ andThen<U>(fn): None
65
+ ```
66
+
67
+ Returns `None` if the Option is `None`, otherwise calls `fn` with the wrapped value and returns the result.
68
+ This function can be used for control flow based on `Option` values.
69
+
70
+ #### Type parameters
71
+
72
+ | Type parameter | Description |
73
+ | :------ | :------ |
74
+ | `U` | The type of the value returned by the function. |
75
+
76
+ #### Parameters
77
+
78
+ | Parameter | Type | Description |
79
+ | :------ | :------ | :------ |
80
+ | `fn` | (`value`) => [`Option`](Option.md)\<`U`\> | A function that takes the contained value and returns an `Option`. |
81
+
82
+ #### Returns
83
+
84
+ [`None`](None.md)
85
+
86
+ The result of `fn` if `this` is `Some`, otherwise `None`.
87
+
88
+ #### Overrides
89
+
90
+ [`Option`](Option.md).[`andThen`](Option.md#andthen)
91
+
92
+ #### Source
93
+
94
+ [enum/prelude.ts:309](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L309)
95
+
96
+ ***
97
+
98
+ ### eq()
99
+
100
+ ```ts
101
+ eq<T>(other): boolean
102
+ ```
103
+
104
+ Tests whether `this` and `other` are both `Some` containing equal values, or both are `None`.
105
+ This method can be used for comparing `Option` instances in a value-sensitive manner.
106
+
107
+ #### Type parameters
108
+
109
+ | Type parameter |
110
+ | :------ |
111
+ | `T` |
112
+
113
+ #### Parameters
114
+
115
+ | Parameter | Type | Description |
116
+ | :------ | :------ | :------ |
117
+ | `other` | [`Option`](Option.md)\<`T`\> | The other `Option` to compare with. |
118
+
119
+ #### Returns
120
+
121
+ `boolean`
122
+
123
+ `true` if `this` and `other` are both `Some` with equal values, or both are `None`, otherwise `false`.
124
+
125
+ #### Overrides
126
+
127
+ [`Option`](Option.md).[`eq`](Option.md#eq)
128
+
129
+ #### Source
130
+
131
+ [enum/prelude.ts:314](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L314)
132
+
133
+ ***
134
+
135
+ ### expect()
136
+
137
+ ```ts
138
+ expect(msg): never
139
+ ```
140
+
141
+ Returns the contained `Some` value, with a provided error message if the value is a `None`.
142
+
143
+ #### Parameters
144
+
145
+ | Parameter | Type | Description |
146
+ | :------ | :------ | :------ |
147
+ | `msg` | `string` | The error message to provide if the value is a `None`. |
148
+
149
+ #### Returns
150
+
151
+ `never`
152
+
153
+ #### Inherited from
154
+
155
+ [`Option`](Option.md).[`expect`](Option.md#expect)
156
+
157
+ #### Throws
158
+
159
+ Throws an error with the provided message if the Option is a `None`.
160
+
161
+ #### Source
162
+
163
+ [enum/prelude.ts:80](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L80)
164
+
165
+ ***
166
+
167
+ ### filter()
168
+
169
+ ```ts
170
+ filter(predicate): None
171
+ ```
172
+
173
+ Returns `None` if the Option is `None`, otherwise calls predicate with the wrapped value and returns:
174
+ - `Some(t)` if predicate returns `true` (where `t` is the wrapped value), and
175
+ - `None` if predicate returns `false`.
176
+
177
+ #### Parameters
178
+
179
+ | Parameter | Type | Description |
180
+ | :------ | :------ | :------ |
181
+ | `predicate` | (`value`) => `boolean` | A function that takes the contained value and returns a boolean. |
182
+
183
+ #### Returns
184
+
185
+ [`None`](None.md)
186
+
187
+ #### Overrides
188
+
189
+ [`Option`](Option.md).[`filter`](Option.md#filter)
190
+
191
+ #### Source
192
+
193
+ [enum/prelude.ts:300](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L300)
194
+
195
+ ***
196
+
197
+ ### flatten()
198
+
199
+ ```ts
200
+ flatten(): None
201
+ ```
202
+
203
+ Converts from `Option<Option<T>>` to `Option<T>`.
204
+
205
+ #### Returns
206
+
207
+ [`None`](None.md)
208
+
209
+ `None` if the Option is `None`, otherwise returns the contained `Option`.
210
+
211
+ #### Overrides
212
+
213
+ [`Option`](Option.md).[`flatten`](Option.md#flatten)
214
+
215
+ #### Source
216
+
217
+ [enum/prelude.ts:301](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L301)
218
+
219
+ ***
220
+
221
+ ### inspect()
222
+
223
+ ```ts
224
+ inspect(fn): this
225
+ ```
226
+
227
+ Calls the provided function with the contained value if `this` is `Some`.
228
+ This is primarily for side effects and does not transform the `Option`.
229
+
230
+ #### Parameters
231
+
232
+ | Parameter | Type | Description |
233
+ | :------ | :------ | :------ |
234
+ | `fn` | (`value`) => `void` | A function to call with the contained value. |
235
+
236
+ #### Returns
237
+
238
+ `this`
239
+
240
+ `this`, unmodified, for chaining additional methods.
241
+
242
+ #### Inherited from
243
+
244
+ [`Option`](Option.md).[`inspect`](Option.md#inspect)
245
+
246
+ #### Source
247
+
248
+ [enum/prelude.ts:267](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L267)
249
+
250
+ ***
251
+
252
+ ### isNone()
253
+
254
+ ```ts
255
+ isNone(): boolean
256
+ ```
257
+
258
+ Returns `true` if the Option is a `None` value.
259
+
260
+ #### Returns
261
+
262
+ `boolean`
263
+
264
+ #### Inherited from
265
+
266
+ [`Option`](Option.md).[`isNone`](Option.md#isnone)
267
+
268
+ #### Source
269
+
270
+ [enum/prelude.ts:59](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L59)
271
+
272
+ ***
273
+
274
+ ### isSome()
275
+
276
+ ```ts
277
+ isSome(): boolean
278
+ ```
279
+
280
+ Returns `true` if the Option is a `Some` value.
281
+
282
+ #### Returns
283
+
284
+ `boolean`
285
+
286
+ #### Inherited from
287
+
288
+ [`Option`](Option.md).[`isSome`](Option.md#issome)
289
+
290
+ #### Source
291
+
292
+ [enum/prelude.ts:54](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L54)
293
+
294
+ ***
295
+
296
+ ### isSomeAnd()
297
+
298
+ ```ts
299
+ isSomeAnd(predicate): boolean
300
+ ```
301
+
302
+ Returns `true` if the Option is a `Some` value and the predicate returns `true` for the contained value.
303
+
304
+ #### Parameters
305
+
306
+ | Parameter | Type | Description |
307
+ | :------ | :------ | :------ |
308
+ | `predicate` | (`value`) => `boolean` | A function that takes the contained value and returns a boolean. |
309
+
310
+ #### Returns
311
+
312
+ `boolean`
313
+
314
+ #### Inherited from
315
+
316
+ [`Option`](Option.md).[`isSomeAnd`](Option.md#issomeand)
317
+
318
+ #### Source
319
+
320
+ [enum/prelude.ts:65](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L65)
321
+
322
+ ***
323
+
324
+ ### map()
325
+
326
+ ```ts
327
+ map<U>(fn): None
328
+ ```
329
+
330
+ Maps an `Option<T>` to `Option<U>` by applying a function to a contained value.
331
+
332
+ #### Type parameters
333
+
334
+ | Type parameter | Description |
335
+ | :------ | :------ |
336
+ | `U` | The type of the value returned by the map function. |
337
+
338
+ #### Parameters
339
+
340
+ | Parameter | Type | Description |
341
+ | :------ | :------ | :------ |
342
+ | `fn` | (`value`) => `U` | A function that takes the contained value and returns a new value. |
343
+
344
+ #### Returns
345
+
346
+ [`None`](None.md)
347
+
348
+ #### Overrides
349
+
350
+ [`Option`](Option.md).[`map`](Option.md#map)
351
+
352
+ #### Source
353
+
354
+ [enum/prelude.ts:302](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L302)
355
+
356
+ ***
357
+
358
+ ### mapOr()
359
+
360
+ ```ts
361
+ mapOr<U>(defaultValue, fn): U
362
+ ```
363
+
364
+ Maps an `Option<T>` to `U` by applying a function to the contained value (if any), or returns the provided default (if not).
365
+
366
+ #### Type parameters
367
+
368
+ | Type parameter | Description |
369
+ | :------ | :------ |
370
+ | `U` | The type of the value returned by the map function or the default value. |
371
+
372
+ #### Parameters
373
+
374
+ | Parameter | Type | Description |
375
+ | :------ | :------ | :------ |
376
+ | `defaultValue` | `U` | The value to return if the Option is `None`. |
377
+ | `fn` | (`value`) => `U` | A function that takes the contained value and returns a new value. |
378
+
379
+ #### Returns
380
+
381
+ `U`
382
+
383
+ #### Inherited from
384
+
385
+ [`Option`](Option.md).[`mapOr`](Option.md#mapor)
386
+
387
+ #### Source
388
+
389
+ [enum/prelude.ts:163](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L163)
390
+
391
+ ***
392
+
393
+ ### mapOrElse()
394
+
395
+ ```ts
396
+ mapOrElse<U>(defaultFn, fn): U
397
+ ```
398
+
399
+ Maps an `Option<T>` to `U` by applying a function to a contained value (if any), or computes a default (if not).
400
+
401
+ #### Type parameters
402
+
403
+ | Type parameter | Description |
404
+ | :------ | :------ |
405
+ | `U` | The type of the value returned by the map function or the default function. |
406
+
407
+ #### Parameters
408
+
409
+ | Parameter | Type | Description |
410
+ | :------ | :------ | :------ |
411
+ | `defaultFn` | () => `U` | A function that returns the default value. |
412
+ | `fn` | (`value`) => `U` | A function that takes the contained value and returns a new value. |
413
+
414
+ #### Returns
415
+
416
+ `U`
417
+
418
+ #### Inherited from
419
+
420
+ [`Option`](Option.md).[`mapOrElse`](Option.md#maporelse)
421
+
422
+ #### Source
423
+
424
+ [enum/prelude.ts:171](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L171)
425
+
426
+ ***
427
+
428
+ ### okOr()
429
+
430
+ ```ts
431
+ okOr<E>(error): Result<never, E>
432
+ ```
433
+
434
+ Transforms the `Option<T>` into a `Result<T, E>`, mapping `Some(v)` to `Ok(v)` and `None` to `Err(err)`.
435
+
436
+ #### Type parameters
437
+
438
+ | Type parameter | Description |
439
+ | :------ | :------ |
440
+ | `E` | The type of the error value in the `Err` variant of the resulting `Result`. |
441
+
442
+ #### Parameters
443
+
444
+ | Parameter | Type | Description |
445
+ | :------ | :------ | :------ |
446
+ | `error` | `E` | The error value to use if the Option is a `None`. |
447
+
448
+ #### Returns
449
+
450
+ [`Result`](Result.md)\<`never`, `E`\>
451
+
452
+ #### Inherited from
453
+
454
+ [`Option`](Option.md).[`okOr`](Option.md#okor)
455
+
456
+ #### Source
457
+
458
+ [enum/prelude.ts:113](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L113)
459
+
460
+ ***
461
+
462
+ ### okOrElse()
463
+
464
+ ```ts
465
+ okOrElse<E>(err): Result<never, E>
466
+ ```
467
+
468
+ Transforms the `Option<T>` into a `Result<T, E>`, mapping `Some(v)` to `Ok(v)` and `None` to `Err(err())`.
469
+
470
+ #### Type parameters
471
+
472
+ | Type parameter | Description |
473
+ | :------ | :------ |
474
+ | `E` | The type of the error value in the `Err` variant of the resulting `Result`. |
475
+
476
+ #### Parameters
477
+
478
+ | Parameter | Type | Description |
479
+ | :------ | :------ | :------ |
480
+ | `err` | () => `E` | A function that returns the error value. |
481
+
482
+ #### Returns
483
+
484
+ [`Result`](Result.md)\<`never`, `E`\>
485
+
486
+ #### Inherited from
487
+
488
+ [`Option`](Option.md).[`okOrElse`](Option.md#okorelse)
489
+
490
+ #### Source
491
+
492
+ [enum/prelude.ts:120](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L120)
493
+
494
+ ***
495
+
496
+ ### or()
497
+
498
+ ```ts
499
+ or<T>(other): Option<T>
500
+ ```
501
+
502
+ Returns the Option if it contains a value, otherwise returns `other`.
503
+ This can be used for providing a fallback `Option`.
504
+
505
+ #### Type parameters
506
+
507
+ | Type parameter |
508
+ | :------ |
509
+ | `T` |
510
+
511
+ #### Parameters
512
+
513
+ | Parameter | Type | Description |
514
+ | :------ | :------ | :------ |
515
+ | `other` | [`Option`](Option.md)\<`T`\> | The fallback `Option` to use if `this` is `None`. |
516
+
517
+ #### Returns
518
+
519
+ [`Option`](Option.md)\<`T`\>
520
+
521
+ `this` if it is `Some`, otherwise `other`.
522
+
523
+ #### Overrides
524
+
525
+ [`Option`](Option.md).[`or`](Option.md#or)
526
+
527
+ #### Source
528
+
529
+ [enum/prelude.ts:310](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L310)
530
+
531
+ ***
532
+
533
+ ### orElse()
534
+
535
+ ```ts
536
+ orElse<T>(fn): Option<T>
537
+ ```
538
+
539
+ Returns the Option if it contains a value, otherwise calls `fn` and returns the result.
540
+ This method can be used for lazy fallbacks, as `fn` is only evaluated if `this` is `None`.
541
+
542
+ #### Type parameters
543
+
544
+ | Type parameter |
545
+ | :------ |
546
+ | `T` |
547
+
548
+ #### Parameters
549
+
550
+ | Parameter | Type | Description |
551
+ | :------ | :------ | :------ |
552
+ | `fn` | () => [`Option`](Option.md)\<`T`\> | A function that produces an `Option`. |
553
+
554
+ #### Returns
555
+
556
+ [`Option`](Option.md)\<`T`\>
557
+
558
+ `this` if it is `Some`, otherwise the result of `fn`.
559
+
560
+ #### Overrides
561
+
562
+ [`Option`](Option.md).[`orElse`](Option.md#orelse)
563
+
564
+ #### Source
565
+
566
+ [enum/prelude.ts:311](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L311)
567
+
568
+ ***
569
+
570
+ ### transpose()
571
+
572
+ ```ts
573
+ transpose(): Result<None, never>
574
+ ```
575
+
576
+ Transposes an `Option` of a `Result` into a `Result` of an `Option`.
577
+
578
+ #### Returns
579
+
580
+ [`Result`](Result.md)\<[`None`](None.md), `never`\>
581
+
582
+ `Ok` containing `Some` if the Option is a `Some` containing `Ok`,
583
+ `Err` containing the error if the Option is a `Some` containing `Err`,
584
+ `Ok` containing `None` if the Option is `None`.
585
+
586
+ #### Overrides
587
+
588
+ [`Option`](Option.md).[`transpose`](Option.md#transpose)
589
+
590
+ #### Source
591
+
592
+ [enum/prelude.ts:298](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L298)
593
+
594
+ ***
595
+
596
+ ### unwrap()
597
+
598
+ ```ts
599
+ unwrap(): never
600
+ ```
601
+
602
+ Returns the contained `Some` value.
603
+
604
+ #### Returns
605
+
606
+ `never`
607
+
608
+ #### Inherited from
609
+
610
+ [`Option`](Option.md).[`unwrap`](Option.md#unwrap)
611
+
612
+ #### Throws
613
+
614
+ Throws an error if the value is a `None`.
615
+
616
+ #### Source
617
+
618
+ [enum/prelude.ts:86](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L86)
619
+
620
+ ***
621
+
622
+ ### unwrapOr()
623
+
624
+ ```ts
625
+ unwrapOr<T>(defaultValue): T
626
+ ```
627
+
628
+ Returns the contained `Some` value or a provided default.
629
+
630
+ #### Type parameters
631
+
632
+ | Type parameter |
633
+ | :------ |
634
+ | `T` |
635
+
636
+ #### Parameters
637
+
638
+ | Parameter | Type | Description |
639
+ | :------ | :------ | :------ |
640
+ | `defaultValue` | `T` | The value to return if the Option is a `None`. |
641
+
642
+ #### Returns
643
+
644
+ `T`
645
+
646
+ #### Overrides
647
+
648
+ [`Option`](Option.md).[`unwrapOr`](Option.md#unwrapor)
649
+
650
+ #### Source
651
+
652
+ [enum/prelude.ts:295](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L295)
653
+
654
+ ***
655
+
656
+ ### unwrapOrElse()
657
+
658
+ ```ts
659
+ unwrapOrElse<T>(fn): T
660
+ ```
661
+
662
+ Returns the contained `Some` value or computes it from a closure.
663
+
664
+ #### Type parameters
665
+
666
+ | Type parameter |
667
+ | :------ |
668
+ | `T` |
669
+
670
+ #### Parameters
671
+
672
+ | Parameter | Type | Description |
673
+ | :------ | :------ | :------ |
674
+ | `fn` | () => `T` | A function that returns the default value. |
675
+
676
+ #### Returns
677
+
678
+ `T`
679
+
680
+ #### Overrides
681
+
682
+ [`Option`](Option.md).[`unwrapOrElse`](Option.md#unwraporelse)
683
+
684
+ #### Source
685
+
686
+ [enum/prelude.ts:296](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L296)
687
+
688
+ ***
689
+
690
+ ### unzip()
691
+
692
+ ```ts
693
+ unzip(): [None, None]
694
+ ```
695
+
696
+ Converts from `Option<[T, U]>` to `[Option<T>, Option<U>]`.
697
+ If `this` is `Some([a, b])`, returns `[Some(a), Some(b)]`.
698
+ If `this` is `None`, returns `[None, None]`.
699
+
700
+ #### Returns
701
+
702
+ [[`None`](None.md), [`None`](None.md)]
703
+
704
+ A tuple of `Options`, one for each element in the original `Option` of a tuple.
705
+
706
+ #### Overrides
707
+
708
+ [`Option`](Option.md).[`unzip`](Option.md#unzip)
709
+
710
+ #### Source
711
+
712
+ [enum/prelude.ts:306](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L306)
713
+
714
+ ***
715
+
716
+ ### xor()
717
+
718
+ ```ts
719
+ xor<T>(other): Option<T>
720
+ ```
721
+
722
+ Returns `Some` if exactly one of `this`, `other` is `Some`, otherwise returns `None`.
723
+ This can be thought of as an exclusive or operation on `Option` values.
724
+
725
+ #### Type parameters
726
+
727
+ | Type parameter |
728
+ | :------ |
729
+ | `T` |
730
+
731
+ #### Parameters
732
+
733
+ | Parameter | Type | Description |
734
+ | :------ | :------ | :------ |
735
+ | `other` | [`Option`](Option.md)\<`T`\> | The other `Option` to compare with. |
736
+
737
+ #### Returns
738
+
739
+ [`Option`](Option.md)\<`T`\>
740
+
741
+ `Some` if exactly one of `this` and `other` is `Some`, otherwise `None`.
742
+
743
+ #### Overrides
744
+
745
+ [`Option`](Option.md).[`xor`](Option.md#xor)
746
+
747
+ #### Source
748
+
749
+ [enum/prelude.ts:312](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L312)
750
+
751
+ ***
752
+
753
+ ### zip()
754
+
755
+ ```ts
756
+ zip<U>(other): None
757
+ ```
758
+
759
+ Combines `this` with another `Option` by zipping their contained values.
760
+ If `this` is `Some(s)` and `other` is `Some(o)`, returns `Some([s, o])`.
761
+ If either `this` or `other` is `None`, returns `None`.
762
+
763
+ #### Type parameters
764
+
765
+ | Type parameter | Description |
766
+ | :------ | :------ |
767
+ | `U` | The type of the value in the other `Option`. |
768
+
769
+ #### Parameters
770
+
771
+ | Parameter | Type | Description |
772
+ | :------ | :------ | :------ |
773
+ | `other` | [`Option`](Option.md)\<`U`\> | The other `Option` to zip with. |
774
+
775
+ #### Returns
776
+
777
+ [`None`](None.md)
778
+
779
+ An `Option` containing a tuple of the values if both are `Some`, otherwise `None`.
780
+
781
+ #### Overrides
782
+
783
+ [`Option`](Option.md).[`zip`](Option.md#zip)
784
+
785
+ #### Source
786
+
787
+ [enum/prelude.ts:304](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L304)
788
+
789
+ ***
790
+
791
+ ### zipWith()
792
+
793
+ ```ts
794
+ zipWith<U, R>(other, fn): None
795
+ ```
796
+
797
+ Zips `this` with another `Option` using a provided function to combine their contained values.
798
+ If `this` is `Some(s)` and `other` is `Some(o)`, returns `Some(fn(s, o))`.
799
+ If either `this` or `other` is `None`, returns `None`.
800
+
801
+ #### Type parameters
802
+
803
+ | Type parameter | Description |
804
+ | :------ | :------ |
805
+ | `U` | The type of the value in the other `Option`. |
806
+ | `R` | The return type of the combining function. |
807
+
808
+ #### Parameters
809
+
810
+ | Parameter | Type | Description |
811
+ | :------ | :------ | :------ |
812
+ | `other` | [`Option`](Option.md)\<`U`\> | The other `Option` to zip with. |
813
+ | `fn` | (`value`, `otherValue`) => `R` | The function to combine the values from both `Options`. |
814
+
815
+ #### Returns
816
+
817
+ [`None`](None.md)
818
+
819
+ An `Option` containing the result of `fn` if both `Options` are `Some`, otherwise `None`.
820
+
821
+ #### Overrides
822
+
823
+ [`Option`](Option.md).[`zipWith`](Option.md#zipwith)
824
+
825
+ #### Source
826
+
827
+ [enum/prelude.ts:305](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L305)