-
-
Save arnygora/70b554440861a1fc3af42e0101f28bec to your computer and use it in GitHub Desktop.
RxJS operator functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Observable } from 'rxjs'; | |
import { filter } from 'rxjs/operators'; | |
function inputIsNotNullOrUndefined<T>(input: null | undefined | T): input is T { | |
return input !== null && input !== undefined; | |
} | |
export function isNotNullOrUndefined<T>() { | |
return (source$: Observable<null | undefined | T>) => | |
source$.pipe( | |
filter(inputIsNotNullOrUndefined) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment