Code coverage report for src/operator/concatMapTo.ts

Statements: 100% (4 / 4)      Branches: 100% (0 / 0)      Functions: 100% (1 / 1)      Lines: 100% (3 / 3)      Ignored: none     

All files » src/operator/ » concatMapTo.ts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25  1                             1           25    
import {Observable} from '../Observable';
import {MergeMapToOperator} from './mergeMapTo';
 
/**
 * Maps values from the source to a specific observable, and merges them together in a serialized fashion.
 *
 * @param {Observable} observable the observable to map each source value to
 * @param {function} [resultSelector] an optional result selector that is applied to values before they're
 * merged into the returned observable. The arguments passed to this function are:
 * - `outerValue`: the value that came from the source
 * - `innerValue`: the value that came from the projected Observable
 * - `outerIndex`: the "index" of the value that came from the source
 * - `innerIndex`: the "index" of the value from the projected Observable
 * @returns {Observable} an observable of values merged together by joining the passed observable
 * with itself, one after the other, for each value emitted from the source.
 */
export function concatMapTo<T, R, R2>(observable: Observable<R>,
                                      resultSelector?: (
                                                outerValue: T,
                                                innerValue: R,
                                                outerIndex: number,
                                                innerIndex: number) => R2): Observable<R2> {
  return this.lift(new MergeMapToOperator(observable, resultSelector, 1));
}