iff<T> function

Observable<T> iff<T>(
  1. Predicate0 condition, [
  2. Observable<T>? trueBranch,
  3. Observable<T>? falseBranch
])

Decides at subscription time which Observable will actually be subscribed to.

Implementation

Observable<T> iff<T>(Predicate0 condition,
        [Observable<T>? trueBranch, Observable<T>? falseBranch]) =>
    defer(() => condition() ? trueBranch ?? empty() : falseBranch ?? empty());