MCPcopy Index your code
hub / github.com/Effect-TS/effect / firstSomeOf

Function firstSomeOf

packages/effect/src/Option.ts:651–661  ·  view source on GitHub ↗
(
  collection: C
)

Source from the content-addressed store, hash-verified

649 * @since 2.0.0
650 */
651export 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

Callers

nothing calls this directly

Calls 2

noneFunction · 0.85
isSomeFunction · 0.85

Tested by

no test coverage detected