Skip to main content

namespace AsyncTransformer

An AsyncReducer that produces instances of AsyncStreamSource.

Companion type: AsyncTransformer<T,R>

Functions

distinctPrevious

Returns an async transformer that returns only those elements from the input that are different to previous element according to the optionally given eq function.

Definition

function distinctPrevious<T>(eq?: Eq<T>): AsyncTransformer<T>;

Type parameters
NameDescription
T

Parameters

NameTypeDescription
eqEq<T>(default: Eq.objectIs) the equality testing function
example
await AsyncStream.of(1, 1, 2, 3, 2, 2)
.transform(AsyncTransformer.distinctPrevious())
.toArray()
// => [1, 2, 3, 2]

Constants

NameDescription
windowReturns an async transformer that produces windows/collections of windowSize size, each window starting skipAmount of elements after the previous, and optionally collected by a custom reducer.