Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/rimbu/mod.ts>AsyncTransformer.splitWhere

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
function AsyncTransformer.splitWhere
import { AsyncTransformer } from "https://deno.land/x/rimbu@1.2.0/mod.ts";
const { splitWhere } = AsyncTransformer;

Returns an AsyncTransformer that applies the given pred function to each received element, and collects the received elements into a collector that will be returned as output every time the predicate returns true.

Parameters

pred: (value: T, index: number) => MaybePromise<boolean>
  • a potentially async predicate function taking an element
optional
options: { negate?: boolean | undefined; collector?: AsyncReducer.Accept<T, R> | undefined; } = [UNSUPPORTED]
  • (optional) object specifying the following properties
  • negate: (default: false) when true will negate the given predicate
  • collector: (default: Reducer.toArray()) an AsyncReducer that can accept multiple values and reduce them into a single value of type R.