import { Observable , ObservableInput } from 'rxjs' ; import { filter , map , withLatestFrom } from 'rxjs/operators' ; export function filterWith < T , S > ( input , predicate ) { return ( source ) => source . pipe ( withLatestFrom ( input ) , filter ( ( [ sourceValue , inputValue ] ) => predicate ( inputValue ) ) , map ( ( [ sourceValue ] ) => sourceValue ) ) ; }