I have a javascript function which returns an boolean in some cases or an Observable in some other cases. Can I somehow always return an Observable by creating Observable out of a boolean?
You want the rxjs .of() method (https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/of.md) so you can return a observable that emits a boolean
return Observable.of(boolean);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With