( collection: C )
| 649 | * @since 2.0.0 |
| 650 | */ |
| 651 | export const firstSomeOf = <T, C extends Iterable<Option<T>> = Iterable<Option<T>>>( |
| 652 | collection: C |
| 653 | ): [C] extends [Iterable<Option<infer A>>] ? Option<A> : never => { |
| 654 | let out: Option<unknown> = none() |
| 655 | for (out of collection) { |
| 656 | if (isSome(out)) { |
| 657 | return out as any |
| 658 | } |
| 659 | } |
| 660 | return out as any |
| 661 | } |
| 662 | |
| 663 | /** |
| 664 | * Converts a nullable value into an `Option`. Returns `None` if the value is |