Skip to content

Instantly share code, notes, and snippets.

@evgenyfedorenko
Created November 11, 2019 21:02
Show Gist options
  • Save evgenyfedorenko/4e0210bfe078eccd48297c4ca5561c04 to your computer and use it in GitHub Desktop.
Save evgenyfedorenko/4e0210bfe078eccd48297c4ca5561c04 to your computer and use it in GitHub Desktop.
export function select<T, Props, K>(selector: (state: T, props?: Props) => any) {
return function selectOperator(source$: Observable<T>): Observable<K> {
let mapped$: Observable<any>;
mapped$ = source$.pipe(
map(source => selector(source))
);
return mapped$.pipe(distinctUntilChanged());
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment