This repository has been archived on 2026-03-06. You can view files and clone it, but cannot push or open issues or pull requests.
todo/node_modules/rxjs/dist/esm5/internal/operators/take.js

20 lines
689 B
JavaScript
Raw Normal View History

2025-06-13 06:04:40 +00:00
import { EMPTY } from '../observable/empty';
import { operate } from '../util/lift';
import { createOperatorSubscriber } from './OperatorSubscriber';
export function take(count) {
return count <= 0
?
function () { return EMPTY; }
: operate(function (source, subscriber) {
var seen = 0;
source.subscribe(createOperatorSubscriber(subscriber, function (value) {
if (++seen <= count) {
subscriber.next(value);
if (count <= seen) {
subscriber.complete();
}
}
}));
});
}
//# sourceMappingURL=take.js.map