dist/async-iterable/operators.js
/** Take and yield the first N items in an iterable sequence */
Take and yield the first N items in an iterable sequence
Take and yield the first N items in an iterable sequence
function take(count) {
    return function (iterable) {
        return __asyncGenerator(this, arguments, function* () {
            var e_9, _a;
            let i = 0;
            try {
                for (var iterable_7 = __asyncValues(iterable), iterable_7_1; iterable_7_1 = yield __await(iterable_7.next()), !iterable_7_1.done;) {
                    const item = iterable_7_1.value;
                    if (i >= count) {
                        return yield __await(void 0);
                    }
                    yield yield __await(item);
                    i = i + 1;
                }
            }
            catch (e_9_1) { e_9 = { error: e_9_1 }; }
            finally {
                try {
                    if (iterable_7_1 && !iterable_7_1.done && (_a = iterable_7.return)) yield __await(_a.call(iterable_7));
                }
                finally { if (e_9) throw e_9.error; }
            }
        });
    };
}
function take ( count ) { return function ( iterable ) { return __asyncGenerator ( this , arguments , function * ( ) { var e_9 , _a ; let i = 0 ; try { for ( var iterable_7 = __asyncValues ( iterable ) , iterable_7_1 ; iterable_7_1 = yield __await ( iterable_7 . next ( ) ) , ! iterable_7_1 . done ; ) { const item = iterable_7_1 . value ; if ( i >= count ) { return yield __await ( void 0 ) ; } yield yield __await ( item ) ; i = i + 1 ; } } catch ( e_9_1 ) { e_9 = { error : e_9_1 } ; } finally { try { if ( iterable_7_1 && ! iterable_7_1 . done && ( _a = iterable_7 . return ) ) yield __await ( _a . call ( iterable_7 ) ) ; } finally { if ( e_9 ) throw e_9 . error ; } } } ) ; } ; }
Take and yield the first N items in an iterable sequence
Take and yield the first N items in an iterable sequence