# Code coverage report for RxJS/dist/cjs/operators/combineLatest-static.js

## Statements: 100% (17 / 17) Branches: 87.5% (7 / 8) Functions: 100% (2 / 2) Lines: 100% (16 / 16) Ignored: none

All files » RxJS/dist/cjs/operators/ » combineLatest-static.js

    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
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42

    1
    1

    1

    1

    1

    1

    1
    2

    2
    6

    2
    1

    2
    1

    2

    1'use strict';

    exports.__esModule = true;
    exports['default'] = combineLatest;

    function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

    var _observablesArrayObservable = require('../observables/ArrayObservable');

    var _observablesArrayObservable2 = _interopRequireDefault(_observablesArrayObservable);

    var _combineLatestSupport = require('./combineLatest-support');

    /**
     * Combines the values from observables passed as arguments. This is done by subscribing
     * to each observable, in order, and collecting an array of each of the most recent values any time any of the observables
     * emits, then either taking that array and passing it as arguments to an option `project` function and emitting the return
     * value of that, or just emitting the array of recent values directly if there is no `project` function.
     * @param {...Observable} observables the observables to combine
     * @param {function} [project] an optional function to project the values from the combined recent values into a new value for emission.
     * @returns {Observable} an observable of other projected values from the most recent values from each observable, or an array of each of
     * the most recent values from each observable.
     */

    function combineLatest() {
        var project = undefined,
            scheduler = undefined;

        for (var _len = arguments.length, observables = Array(_len), _key = 0; _key < _len; _key++) {
            observables[_key] = arguments[_key];
        }

        if (typeof observables[observables.length - 1].schedule === 'function') {
            scheduler = observables.pop();
        }
        if (typeof observables[observables.length - 1] === 'function') {
            project = observables.pop();
        }
        return new _observablesArrayObservable2['default'](observables, scheduler).lift(new _combineLatestSupport.CombineLatestOperator(project));
    }

    module.exports = exports['default'];