Hyperlinkv0.8.0-beta.28

Stream

Stream.dropUntilconsteffect/Stream.ts:6731
<A>(predicate: (a: NoInfer<A>, index: number) => boolean): <E, R>(
  self: Stream<A, E, R>
) => Stream<A, E, R>
<A, E, R>(
  self: Stream<A, E, R>,
  predicate: (a: NoInfer<A>, index: number) => boolean
): Stream<A, E, R>

Drops elements until the specified predicate evaluates to true, then drops that matching element.

Example (Dropping until a predicate matches)

import { Console, Effect, Stream } from "effect"

const stream = Stream.make(1, 2, 3, 4, 5)
const result = Stream.dropUntil(stream, (n) => n >= 3)

Effect.gen(function*() {
  const output = yield* Stream.runCollect(result)
  yield* Console.log(output) // Output: [ 4, 5 ]
})
filtering
Source effect/Stream.ts:67317 lines
export const dropUntil: {
  <A>(predicate: (a: NoInfer<A>, index: number) => boolean): <E, R>(self: Stream<A, E, R>) => Stream<A, E, R>
  <A, E, R>(self: Stream<A, E, R>, predicate: (a: NoInfer<A>, index: number) => boolean): Stream<A, E, R>
} = dual(2, <A, E, R>(
  self: Stream<A, E, R>,
  predicate: (a: NoInfer<A>, index: number) => boolean
): Stream<A, E, R> => drop(dropWhile(self, (a, i) => !predicate(a, i)), 1))