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
22 lines (21 loc) • 773 B
TypeScript
type ThrottleOption = {
/** drop=true: Drop chunks by interval, will ensure last item emit by default. set keepLast=false to drop last */
drop?: boolean;
/**
* drop=true: Drop chunks by interval, will ensure last item emit by default. set keepLast=false to drop last
* has no effect when drop=false
*/
keepLast?: boolean;
};
/**
* ```ts
* drop=true: Drop chunks by interval, will ensure last item emit by default.
* set keepLast=false to drop last
*
* @example
* if you dont want item drops, please use forEach to limit speed
* sth like:
* sflow().forEach(sleep(1000)).forEach(sleep(1000)).log().done()
*/
export declare function throttles<T>(interval: number, { drop, keepLast }?: ThrottleOption): TransformStream<T, T>;
export {};