Demo: defaultIfEmpty
The defaultIfEmpty waits till the incoming stream completes and, if there are no items it emits a specified default item.
defaultIfEmpty(defaultItem);
//Almost 70% of time input stream should be empty
let input = iif(() => (Math.random() < 0.7),
EMPTY , timer(500,1500).pipe(take(2)));
//Add "E", if input stream is empty
let process = defaultIfEmpty("E");
let output=input.pipe(process).subscribe(v=>console.log(v))