Skip to content

👜 Callbag operator which emits a given value when source completes without emitting any value.

Notifications You must be signed in to change notification settings

Andarist/callbag-default-if-empty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

callbag-default-if-empty

Callbag operator which emits a given value when source completes without emitting any value.

Example

import defaultIfEmpty from 'callbag-default-if-empty'
import forEach from 'callbag-for-each'
import fromEvent from 'callbag-from-event'
import interval from 'callbag-interval'
import pipe from 'callbag-pipe'
import takeUntil from 'callbag-take-until'

pipe(
  fromEvent(document, 'click'),
  takeUntil(interval(5000)),
  defaultIfEmpty('no clicks'),
  forEach(eventOrDefault => {
    console.log(eventOrDefault)
  }),
)

About

👜 Callbag operator which emits a given value when source completes without emitting any value.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published