UNPKG

sflow

Version:

sflow is a powerful and highly-extensible library designed for processing and manipulating streams of data effortlessly. Inspired by the functional programming paradigm, it provides a rich set of utilities for transforming streams, including chunking, fil

17 lines 707 B
import type { Awaitable } from "./Awaitable"; /** * Takes elements from the stream while the predicate returns true. * Stops and terminates the stream when the predicate returns false. * * @param fn Predicate function that determines whether to continue taking elements * @returns A TransformStream that takes elements while the predicate is true * @template T The type of the input/output stream * @example * sflow([1, 2, 3, 4, 5]) * .takeWhile(x => x < 4) * .toArray() // [1, 2, 3] */ export declare function takeWhiles<T>(fn: (x: T, i: number) => Awaitable<unknown>, { terminate }?: { terminate?: boolean | undefined; }): TransformStream<T, T>; //# sourceMappingURL=takeWhiles.d.ts.map