Filter Operator

Base.filterFunction
filter(filterFn::F) where { F <: Function }

Creates a filter operator, which filters items of the source Observable by emitting only those that satisfy a specified filterFn predicate.

Producing

Stream of type <: Subscribable{L} where L refers to type of source stream

Arguments

  • filterFn::F: predicate function with (data::T) -> Bool signature

Examples

using Rocket

source = from([ 1, 2, 3, 4, 5, 6 ])
subscribe!(source |> filter((d) -> d % 2 == 0), logger())
;

# output

[LogActor] Data: 2
[LogActor] Data: 4
[LogActor] Data: 6
[LogActor] Completed

See also: AbstractOperator, InferableOperator, ProxyObservable, logger

source

Description

Like filter(f, array), this operator takes values from the source Observable, passes them through a predicate function and only emits those values that yielded true.

See also

Operators