Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Andarist/callbag-default-if-empty
👜 Callbag operator which emits a given value when source completes without emitting any value.
https://github.com/Andarist/callbag-default-if-empty
callbag callbags
Last synced: 3 months ago
JSON representation
👜 Callbag operator which emits a given value when source completes without emitting any value.
- Host: GitHub
- URL: https://github.com/Andarist/callbag-default-if-empty
- Owner: Andarist
- Created: 2018-07-20T16:22:38.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-11T19:53:14.000Z (over 6 years ago)
- Last Synced: 2024-10-20T06:23:11.782Z (3 months ago)
- Topics: callbag, callbags
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-callbags - default-if-empty
README
# callbag-default-if-empty
Callbag operator which emits a given value when source completes without emitting any value.
## Example
```js
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)
}),
)
```