MCPcopy Create free account
hub / github.com/effect-app/libs / takeWhile

Function takeWhile

repos/effect/packages/effect/src/Sink.ts:1560–1579  ·  view source on GitHub ↗
(predicate: Predicate<In>)

Source from the content-addressed store, hash-verified

1558 * Accumulates incoming elements into an array.
1559 *
1560 * **When to use**
1561 *
1562 * Use when you need a sink result containing all upstream input elements.
1563 *
1564 * @see {@link take} for collecting only a fixed number of input elements
1565 *
1566 * @category constructors
1567 * @since 4.0.0
1568 */
1569export const collect = <In>(): Sink<Array<In>, In> =>
1570 reduceArray(Arr.empty<In>, (s, arr) => {
1571 s.push(...arr)
1572 return s
1573 })
1574
1575/**
1576 * Collects the longest input prefix whose elements satisfy the predicate or
1577 * refinement.
1578 *
1579 * **Details**
1580 *
1581 * The first failing input is consumed and excluded from the result. Any later
1582 * elements from the same pulled array are returned as leftovers.

Callers 1

takeUntilFunction · 0.85

Calls 6

predicateFunction · 0.85
doneMethod · 0.80
pushMethod · 0.80
fromTransformFunction · 0.70
pipeMethod · 0.65
succeedMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…