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
}