MCPcopy Create free account
hub / github.com/Effect-TS/effect / all

Function all

packages/effect/src/Option.ts:1629–1652  ·  view source on GitHub ↗
(
    input: Iterable<Option<any>> | Record<string, Option<any>>
  )

Source from the content-addressed store, hash-verified

1627 >
1628 : [I] extends [Iterable<Option<infer A>>] ? Option<Array<A>>
1629 : Option<{ -readonly [K in keyof I]: [I[K]] extends [Option<infer A>] ? A : never }> = (
1630 input: Iterable<Option<any>> | Record<string, Option<any>>
1631 ): Option<any> => {
1632 if (Symbol.iterator in input) {
1633 const out: Array<Option<any>> = []
1634 for (const o of (input as Iterable<Option<any>>)) {
1635 if (isNone(o)) {
1636 return none()
1637 }
1638 out.push(o.value)
1639 }
1640 return some(out)
1641 }
1642
1643 const out: Record<string, any> = {}
1644 for (const key of Object.keys(input)) {
1645 const o = input[key]
1646 if (isNone(o)) {
1647 return none()
1648 }
1649 InternalRecord.assignProperty(out, key, o.value)
1650 }
1651 return some(out)
1652 }
1653
1654/**
1655 * Combines two `Option`s using a provided function.

Callers

nothing calls this directly

Calls 4

isNoneFunction · 0.85
pushMethod · 0.80
noneFunction · 0.70
someFunction · 0.70

Tested by

no test coverage detected