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.
distinctPrevious
eq
function.Definition
function distinctPrevious<T>(eq?: Eq<T>):
AsyncTransformer
<T>;
Type parameters
Name | Description |
---|---|
T |
Parameters
Name | Type | Description |
---|---|---|
eq | Eq<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
Name | Description |
---|---|
window | Returns 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. |