Skip to content

Instantly share code, notes, and snippets.

@ptesser
Created May 8, 2019 13:19
Show Gist options
  • Save ptesser/8c477f0c4b31645e6a2aa1d975ae4fbb to your computer and use it in GitHub Desktop.
Save ptesser/8c477f0c4b31645e6a2aa1d975ae4fbb to your computer and use it in GitHub Desktop.
RxJS operator functions
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)
);
}
@dilame
Copy link

dilame commented Feb 14, 2020

Two Beers for this gentleman at my expense!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment