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

Function takeUntil

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

Source from the content-addressed store, hash-verified

1744 * @since 4.0.0
1745 */
1746export const takeUntil = <In>(predicate: Predicate<In>): Sink<Array<In>, In, In> =>
1747 suspend(() => {
1748 let done = false
1749 return takeWhile((i) => {
1750 if (done) return false
1751 done = predicate(i)
1752 return true
1753 })
1754 })
1755
1756/**
1757 * Collects input elements effectfully until the predicate returns `true`,

Callers 1

Stream.tsFile · 0.85

Calls 3

takeWhileFunction · 0.85
predicateFunction · 0.85
suspendFunction · 0.70

Tested by

no test coverage detected