From d55b767039605256c736166a942a9138e3eacfd7 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Sun, 29 Jun 2025 11:49:28 -0700 Subject: remove dev node_modules (oops) --- .../rxjs/src/internal/operators/takeLast.ts | 81 ---------------------- 1 file changed, 81 deletions(-) delete mode 100644 node_modules/rxjs/src/internal/operators/takeLast.ts (limited to 'node_modules/rxjs/src/internal/operators/takeLast.ts') diff --git a/node_modules/rxjs/src/internal/operators/takeLast.ts b/node_modules/rxjs/src/internal/operators/takeLast.ts deleted file mode 100644 index 972d147..0000000 --- a/node_modules/rxjs/src/internal/operators/takeLast.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { EMPTY } from '../observable/empty'; -import { MonoTypeOperatorFunction } from '../types'; -import { operate } from '../util/lift'; -import { createOperatorSubscriber } from './OperatorSubscriber'; - -/** - * Waits for the source to complete, then emits the last N values from the source, - * as specified by the `count` argument. - * - * ![](takeLast.png) - * - * `takeLast` results in an observable that will hold values up to `count` values in memory, - * until the source completes. It then pushes all values in memory to the consumer, in the - * order they were received from the source, then notifies the consumer that it is - * complete. - * - * If for some reason the source completes before the `count` supplied to `takeLast` is reached, - * all values received until that point are emitted, and then completion is notified. - * - * **Warning**: Using `takeLast` with an observable that never completes will result - * in an observable that never emits a value. - * - * ## Example - * - * Take the last 3 values of an Observable with many values - * - * ```ts - * import { range, takeLast } from 'rxjs'; - * - * const many = range(1, 100); - * const lastThree = many.pipe(takeLast(3)); - * lastThree.subscribe(x => console.log(x)); - * ``` - * - * @see {@link take} - * @see {@link takeUntil} - * @see {@link takeWhile} - * @see {@link skip} - * - * @param count The maximum number of values to emit from the end of - * the sequence of values emitted by the source Observable. - * @return A function that returns an Observable that emits at most the last - * `count` values emitted by the source Observable. - */ -export function takeLast(count: number): MonoTypeOperatorFunction { - return count <= 0 - ? () => EMPTY - : operate((source, subscriber) => { - // This buffer will hold the values we are going to emit - // when the source completes. Since we only want to take the - // last N values, we can't emit until we're sure we're not getting - // any more values. - let buffer: T[] = []; - source.subscribe( - createOperatorSubscriber( - subscriber, - (value) => { - // Add the most recent value onto the end of our buffer. - buffer.push(value); - // If our buffer is now larger than the number of values we - // want to take, we remove the oldest value from the buffer. - count < buffer.length && buffer.shift(); - }, - () => { - // The source completed, we now know what are last values - // are, emit them in the order they were received. - for (const value of buffer) { - subscriber.next(value); - } - subscriber.complete(); - }, - // Errors are passed through to the consumer - undefined, - () => { - // During finalization release the values in our buffer. - buffer = null!; - } - ) - ); - }); -} -- cgit v1.2.3