MCPcopy
hub / github.com/Effect-TS/effect / productMany

Function productMany

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

Source from the content-addressed store, hash-verified

1325 * @since 2.0.0
1326 */
1327export const productMany = <A>(
1328 self: Option<A>,
1329 collection: Iterable<Option<A>>
1330): Option<[A, ...Array<A>]> => {
1331 if (isNone(self)) {
1332 return none()
1333 }
1334 const out: [A, ...Array<A>] = [self.value]
1335 for (const o of collection) {
1336 if (isNone(o)) {
1337 return none()
1338 }
1339 out.push(o.value)
1340 }
1341 return some(out)
1342}
1343
1344/**
1345 * Combines a structure of `Option`s into a single `Option` containing the

Callers 2

Option.test.tsFile · 0.50
Predicate.test.tsFile · 0.50

Calls 3

noneFunction · 0.85
someFunction · 0.70
isNoneFunction · 0.50

Tested by

no test coverage detected