import { Observable } from "rxjs" ; import { switchMap , take } from "rxjs/operators" ; param observable param mappingFn export default function mapToFirstValue < TObservableValue , TMappedObservableValue > ( observable , mappingFn ) { return observable . pipe ( take ( 1 ) ) . pipe ( switchMap ( mappingFn ) ) ; } ;