dist/async-iterable/operators.js
/** Yield only the items in an iterable sequence that match the predicate */
Yield only the items in an iterable sequence that match the predicate
Yield only the items in an iterable sequence that match the predicate
function filter(predicate) {
    return function (iterable) {
        return __asyncGenerator(this, arguments, function* () {
            var e_5, _a;
            let index = 0;
            try {
                for (var iterable_3 = __asyncValues(iterable), iterable_3_1; iterable_3_1 = yield __await(iterable_3.next()), !iterable_3_1.done;) {
                    const value = iterable_3_1.value;
                    if (yield __await(predicate(value, index))) {
                        yield yield __await(value);
                    }
                    index = index + 1;
                }
            }
            catch (e_5_1) { e_5 = { error: e_5_1 }; }
            finally {
                try {
                    if (iterable_3_1 && !iterable_3_1.done && (_a = iterable_3.return)) yield __await(_a.call(iterable_3));
                }
                finally { if (e_5) throw e_5.error; }
            }
        });
    };
}
function filter ( predicate ) { return function ( iterable ) { return __asyncGenerator ( this , arguments , function * ( ) { var e_5 , _a ; let index = 0 ; try { for ( var iterable_3 = __asyncValues ( iterable ) , iterable_3_1 ; iterable_3_1 = yield __await ( iterable_3 . next ( ) ) , ! iterable_3_1 . done ; ) { const value = iterable_3_1 . value ; if ( yield __await ( predicate ( value , index ) ) ) { yield yield __await ( value ) ; } index = index + 1 ; } } catch ( e_5_1 ) { e_5 = { error : e_5_1 } ; } finally { try { if ( iterable_3_1 && ! iterable_3_1 . done && ( _a = iterable_3 . return ) ) yield __await ( _a . call ( iterable_3 ) ) ; } finally { if ( e_5 ) throw e_5 . error ; } } } ) ; } ; }
Yield only the items in an iterable sequence that match the predicate
Yield only the items in an iterable sequence that match the predicate