import { MaybeAsync } from '../types'; export type GeneratorForEach = MaybeAsync<(value: InType, index: number, src: AsyncGenerator) => void>; export type GeneratorFilter = MaybeAsync<(value: InType, index: number, src: AsyncGenerator) => any>; export type GeneratorMap = (value: InType, index: number, src: AsyncGenerator) => OutType | Promise; type OnError = (err: Error, value: ValueType, index: number) => Promise | any; /** * Similar to Array#forEach or Stream.PassThrough. * Allows inspection of a pipeline without mutating it. * Note: Pipeline will block until forEach call resolves. */ export declare function forEach(src: AsyncGenerator, fn: GeneratorForEach, onError?: OnError): AsyncGenerator; /** * Similar to Array#map or Stream.Transform. */ export declare function map(src: AsyncGenerator, fn: GeneratorMap, onError?: OnError): AsyncGenerator; /** * Similar to Array#filter */ export declare function filter(src: AsyncGenerator, fn: GeneratorFilter, onError?: OnError): AsyncGenerator; /** * Start consuming generator. * Takes optional forEach function. */ export declare function consume(src: AsyncGenerator, fn?: GeneratorForEach, onError?: OnError): Promise; export declare function unique(source: AsyncIterable, getIdentity: (item: T) => string): AsyncGenerator; export declare const fromArray: (items: T[]) => AsyncGenerator; export declare const transformError: (src: AsyncGenerator, transformFn: (err: any) => any) => AsyncGenerator; export {};