# Code coverage report for RxJS/dist/cjs/operators/mapTo.js

## Statements: 94.12% (32 / 34) Branches: 62.5% (10 / 16) Functions: 100% (10 / 10) Lines: 100% (26 / 26) Ignored: none

All files » RxJS/dist/cjs/operators/ » mapTo.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
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57

    1
    1

    1

    1

    27

    1

    1

    1
    14

    1
    1
    14

    14

    1
    13

    1

    1
    1

    1
    13

    13
    13

    1
    25

    1

    1'use strict';

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

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

    function _inherits(subClass, superClass) { Iif (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); Eif (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

    function _classCallCheck(instance, Constructor) { Iif (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

    var _Subscriber2 = require('../Subscriber');

    var _Subscriber3 = _interopRequireDefault(_Subscriber2);

    /**
     * Maps every value to the same value every time.
     * @param {any} value the value to map each incoming value to
     * @returns {Observable} an observable of the passed value that emits everytime the source does
     */

    function mapTo(value) {
        return this.lift(new MapToOperator(value));
    }

    var MapToOperator = (function () {
        function MapToOperator(value) {
            _classCallCheck(this, MapToOperator);

            this.value = value;
        }

        MapToOperator.prototype.call = function call(subscriber) {
            return new MapToSubscriber(subscriber, this.value);
        };

        return MapToOperator;
    })();

    var MapToSubscriber = (function (_Subscriber) {
        _inherits(MapToSubscriber, _Subscriber);

        function MapToSubscriber(destination, value) {
            _classCallCheck(this, MapToSubscriber);

            _Subscriber.call(this, destination);
            this.value = value;
        }

        MapToSubscriber.prototype._next = function _next(x) {
            this.destination.next(this.value);
        };

        return MapToSubscriber;
    })(_Subscriber3['default']);

    module.exports = exports['default'];