dist/async-iterable/operators.js
/** Take and yield items in an iterable until the passed predicate passes, then abort the sequence */
Take and yield items in an iterable until the passed predicate passes, then abort the sequence
Take and yield items in an iterable until the passed predicate passes then abort the sequence
function takeUntil(predicate) {
    return function (iterable) {
        return __asyncGenerator(this, arguments, function* () {
            var e_16, _a;
            let i = 0;
            try {
                for (var iterable_14 = __asyncValues(iterable), iterable_14_1; iterable_14_1 = yield __await(iterable_14.next()), !iterable_14_1.done;) {
                    const item = iterable_14_1.value;
                    if (yield __await(predicate(item, i))) {
                        return yield __await(void 0);
                    }
                    yield yield __await(item);
                    i = i + 1;
                }
            }
            catch (e_16_1) { e_16 = { error: e_16_1 }; }
            finally {
                try {
                    if (iterable_14_1 && !iterable_14_1.done && (_a = iterable_14.return)) yield __await(_a.call(iterable_14));
                }
                finally { if (e_16) throw e_16.error; }
            }
        });
    };
}
function takeUntil ( predicate ) { return function ( iterable ) { return __asyncGenerator ( this , arguments , function * ( ) { var e_16 , _a ; let i = 0 ; try { for ( var iterable_14 = __asyncValues ( iterable ) , iterable_14_1 ; iterable_14_1 = yield __await ( iterable_14 . next ( ) ) , ! iterable_14_1 . done ; ) { const item = iterable_14_1 . value ; if ( yield __await ( predicate ( item , i ) ) ) { return yield __await ( void 0 ) ; } yield yield __await ( item ) ; i = i + 1 ; } } catch ( e_16_1 ) { e_16 = { error : e_16_1 } ; } finally { try { if ( iterable_14_1 && ! iterable_14_1 . done && ( _a = iterable_14 . return ) ) yield __await ( _a . call ( iterable_14 ) ) ; } finally { if ( e_16 ) throw e_16 . error ; } } } ) ; } ; }
Take and yield items in an iterable until the passed predicate passes, then abort the sequence
Take and yield items in an iterable until the passed predicate passes then abort the sequence