Debian Codegraph @

node/rxjs/dist/esm/internal/operators/take.js

raw
1 import { EMPTY } from '../observable/empty';
2 import { operate } from '../util/lift';
3 import { createOperatorSubscriber } from './OperatorSubscriber';
4 export function take(count) {
5 return count <= 0
6 ?
7 () => EMPTY
8 : operate((source, subscriber) => {
9 let seen = 0;
10 source.subscribe(createOperatorSubscriber(subscriber, (value) => {
11 if (++seen <= count) {
12 subscriber.next(value);
13 if (count <= seen) {
14 subscriber.complete();
15 }
16 }
17 }));
18 });
19 }
20 //# sourceMappingURL=take.js.map