dist/async-iterable/operators.js
/** Take everything but the last N items in an iterable sequence */
Take everything but the last N items in an iterable sequence
Take everything but the last N items in an iterable sequence
function skipLast(count) {
    return function (iterable) {
        return __asyncGenerator(this, arguments, function* () {
            var e_11, _a;
            const buffer = [];
            try {
                for (var iterable_9 = __asyncValues(iterable), iterable_9_1; iterable_9_1 = yield __await(iterable_9.next()), !iterable_9_1.done;) {
                    const item = iterable_9_1.value;
                    buffer.push(item);
                }
            }
            catch (e_11_1) { e_11 = { error: e_11_1 }; }
            finally {
                try {
                    if (iterable_9_1 && !iterable_9_1.done && (_a = iterable_9.return)) yield __await(_a.call(iterable_9));
                }
                finally { if (e_11) throw e_11.error; }
            }
            if (buffer.length < count) {
                return yield __await(void 0);
            }
            yield __await(yield* __asyncDelegator(__asyncValues(buffer.slice(0, buffer.length - count))));
        });
    };
}
function skipLast ( count ) { return function ( iterable ) { return __asyncGenerator ( this , arguments , function * ( ) { var e_11 , _a ; const buffer = [ ] ; try { for ( var iterable_9 = __asyncValues ( iterable ) , iterable_9_1 ; iterable_9_1 = yield __await ( iterable_9 . next ( ) ) , ! iterable_9_1 . done ; ) { const item = iterable_9_1 . value ; buffer . push ( item ) ; } } catch ( e_11_1 ) { e_11 = { error : e_11_1 } ; } finally { try { if ( iterable_9_1 && ! iterable_9_1 . done && ( _a = iterable_9 . return ) ) yield __await ( _a . call ( iterable_9 ) ) ; } finally { if ( e_11 ) throw e_11 . error ; } } if ( buffer . length < count ) { return yield __await ( void 0 ) ; } yield __await ( yield * __asyncDelegator ( __asyncValues ( buffer . slice ( 0 , buffer . length - count ) ) ) ) ; } ) ; } ; }
Take everything but the last N items in an iterable sequence
Take everything but the last N items in an iterable sequence