Skip to content

Instantly share code, notes, and snippets.

@oops-wrong
Last active April 25, 2019 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oops-wrong/a9ba9a0382b8c271a52f08b4c5af155b to your computer and use it in GitHub Desktop.
Save oops-wrong/a9ba9a0382b8c271a52f08b4c5af155b to your computer and use it in GitHub Desktop.
Subscription to both observables but data gets from the second only (spec file https://gist.github.com/oops-wrong/db1b3b481b471cd2117b052d7e171eb5)
export const muteFirst = <T, R>(first$: Observable<T>, second$: Observable<R>): Observable<R> => {
return combineLatest(first$, second$).pipe(
map(([a, b]: [T, R]): R => b),
distinctUntilChanged(),
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment