UNPKG

@johngw/stream

Version:

Reactive programming tools using the WHATWG Streams API.

16 lines 609 B
import type { ReadableWritablePair, UnderlyingSink } from 'node:stream/web'; /** * Creates a {@see WritableReadablePair} that gives chunks to the `sink` when * when `predicate` passes. It will pass **all** chunks to the readable side. * * @remarks * A good way to signal that a sink is targeted to specific chunk types. * * @example * ``` * myStream() * .pipeThrough(tapWhen(isMyChunk, { write(myChunk) {} })) * ``` */ export declare function tapWhen<I, C extends I>(predicate: (chunk: I) => chunk is C, sink: UnderlyingSink<C>): ReadableWritablePair<I, I>; //# sourceMappingURL=tapWhen.d.ts.map