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

Function productMany

packages/effect/src/Option.ts:1566–1581  ·  view source on GitHub ↗
(
  self: Option<A>,
  collection: Iterable<Option<A>>
)

Source from the content-addressed store, hash-verified

1564 * @since 2.0.0
1565 */
1566export const productMany = <A>(
1567 self: Option<A>,
1568 collection: Iterable<Option<A>>
1569): Option<[A, ...Array<A>]> => {
1570 if (isNone(self)) {
1571 return none()
1572 }
1573 const out: [A, ...Array<A>] = [self.value]
1574 for (const o of collection) {
1575 if (isNone(o)) {
1576 return none()
1577 }
1578 out.push(o.value)
1579 }
1580 return some(out)
1581}
1582
1583/**
1584 * Combines a structure of `Option`s (tuple, struct, or iterable) into a single

Callers 1

Option.test.tsFile · 0.85

Calls 4

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

Tested by

no test coverage detected