# Code coverage report for RxJS/dist/cjs/operators/extended/find-support.js

## Statements: 94.92% (56 / 59) Branches: 71.43% (20 / 28) Functions: 100% (11 / 11) Lines: 98.04% (50 / 51) Ignored: none

All files » RxJS/dist/cjs/operators/extended/ » find-support.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
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87

    1

    3

    1

    24

    1

    1

    1

    1

    1

    1

    1

    1
    1
    12

    12
    12
    12
    12

    1
    12

    1

    1

    1
    1

    1
    12

    12
    12
    12
    12
    12
    12
    12

    1
    6
    6
    6

    1
    14
    14

    14
    14
    14
    2
    12
    2

    1
    4

    1

    1'use strict';

    exports.__esModule = true;

    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);

    var _utilTryCatch = require('../../util/tryCatch');

    var _utilTryCatch2 = _interopRequireDefault(_utilTryCatch);

    var _utilErrorObject = require('../../util/errorObject');

    var _utilBindCallback = require('../../util/bindCallback');

    var _utilBindCallback2 = _interopRequireDefault(_utilBindCallback);

    var FindValueOperator = (function () {
        function FindValueOperator(predicate, source, yieldIndex, thisArg) {
            _classCallCheck(this, FindValueOperator);

            this.predicate = predicate;
            this.source = source;
            this.yieldIndex = yieldIndex;
            this.thisArg = thisArg;
        }

        FindValueOperator.prototype.call = function call(observer) {
            return new FindValueSubscriber(observer, this.predicate, this.source, this.yieldIndex, this.thisArg);
        };

        return FindValueOperator;
    })();

    exports.FindValueOperator = FindValueOperator;

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

        function FindValueSubscriber(destination, predicate, source, yieldIndex, thisArg) {
            _classCallCheck(this, FindValueSubscriber);

            _Subscriber.call(this, destination);
            this.source = source;
            this.yieldIndex = yieldIndex;
            this.thisArg = thisArg;
            this.index = 0;
            Eif (typeof predicate === 'function') {
                this.predicate = _utilBindCallback2['default'](predicate, thisArg, 3);
            }
        }

        FindValueSubscriber.prototype.notifyComplete = function notifyComplete(value) {
            var destination = this.destination;
            destination.next(value);
            destination.complete();
        };

        FindValueSubscriber.prototype._next = function _next(value) {
            var predicate = this.predicate;
            Iif (predicate === undefined) {
                this.destination.error(new TypeError('predicate must be a function'));
            }
            var index = this.index++;
            var result = _utilTryCatch2['default'](predicate)(value, index, this.source);
            if (result === _utilErrorObject.errorObject) {
                this.destination.error(result.e);
            } else if (result) {
                this.notifyComplete(this.yieldIndex ? index : value);
            }
        };

        FindValueSubscriber.prototype._complete = function _complete() {
            this.notifyComplete(this.yieldIndex ? -1 : undefined);
        };

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

    exports.FindValueSubscriber = FindValueSubscriber;