Skip to main content
Module

x/async_channels/mod.ts>Channel#filter

Inspired by Go & Clojure Channels, async_channels provides channels as an asynchronous communication method between asynchronous functions.
Latest
method Channel.prototype.filter
Re-export
import { Channel } from "https://deno.land/x/async_channels@v1.0.0-rc8/mod.ts";

filter applies fn to each value in this channel, and returns a new channel that will only contain value for which fn returned true (or a promise that resolves to true).

The returned channel will close after this channel closes (or if the provided signal is triggered).

Parameters

fn: (val: T) => boolean | Promise<boolean>

The filter function to use.

optional
pipeOpts: ChannelPipeOptions