Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

takeUntil

import { takeUntil } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/async_iterable.ts";

Take values from an AsyncIterable until a predicate is true.

@example
import { takeUntil } from "./async_iterable.ts";
import { fromIterable } from "./async_iterable.ts";
import { pipe } from "./fn.ts";

const numbers = fromIterable([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
const result = pipe(
  numbers,
  takeUntil(n => n > 5)
);

for await (const value of result) {
  console.log(value); // 1, 2, 3, 4, 5
}
function takeUntil<A>(predicate: Predicate<A>): (ta: AsyncIterable<A>) => AsyncIterable<A>;
§
takeUntil<A>(predicate: Predicate<A>): (ta: AsyncIterable<A>) => AsyncIterable<A>
[src]

§Type Parameters

§Parameters

§
predicate: Predicate<A>
[src]

§Return Type

§
(ta: AsyncIterable<A>) => AsyncIterable<A>
[src]