dist/iterable/operators.js
/** Take only the last N items in an iterable sequence */
Take only the last N items in an iterable sequence
Take only the last N items in an iterable sequence
function takeLast(count) {
    return function* (iterable) {
        const buffer = [];
        for (const item of iterable) {
            buffer.push(item);
            if (buffer.length > count) {
                buffer.shift();
            }
        }
        return yield* buffer;
    };
}
function takeLast ( count ) { return function * ( iterable ) { const buffer = [ ] ; for ( const item of iterable ) { buffer . push ( item ) ; if ( buffer . length > count ) { buffer . shift ( ) ; } } return yield * buffer ; } ; }
Take only the last N items in an iterable sequence
Take only the last N items in an iterable sequence