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

Function takeUntil

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

Source from the content-addressed store, hash-verified

1714 const out = Arr.empty<Out>()
1715 let leftover: Arr.NonEmptyReadonlyArray<In> | undefined = undefined
1716 return upstream.pipe(
1717 Effect.flatMap((arr) => {
1718 let i = 0
1719 return Effect.whileLoop({
1720 while: () => i < arr.length,
1721 body: constant(Effect.flatMap(Effect.suspend(() => filter(arr[i++])), (result) => {
1722 if (Result.isFailure(result)) {
1723 if (i < arr.length) {
1724 leftover = arr.slice(i) as any
1725 }
1726 return Cause.done()
1727 }

Callers 1

Stream.tsFile · 0.85

Calls 3

takeWhileFunction · 0.85
predicateFunction · 0.85
suspendFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…