Skip to content

Instantly share code, notes, and snippets.

@Omi0
Forked from ptesser/operators.ts
Created September 17, 2020 09:29
Show Gist options
  • Save Omi0/76839966772dcda1b2e64d727d268020 to your computer and use it in GitHub Desktop.
Save Omi0/76839966772dcda1b2e64d727d268020 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)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment