Mult
Overview
Mult is an opposite idea to Mix. It is a set of tools to setup a flow of data from one channel to many channels, a way to distribute a copy of values to other channels.
Filtering values based on a predicate
tap
function can also accept a predicate function as a third parameter to filter values that will flow from source channel to destination channel.
API
attachMulter<T = any>(ch: Channel): void
Will simply attach a special multer object to the channel which will let us pass this channel to other functions from multer package.
tap<T = any>(sourceChannel: Channel, destinationChannel: Channel, filter?: (data: T) => boolean): void
Will add a destination channel to the multer which will cause source channel to distribute a copy of its values to the destination channel. Also accepts a filter function which we looked at above.
untap<T = any>(sourceChannel: Channel, destinationChannelId: string): void
Provides a way to remove a destination channel from the multer.
Last updated