wishthis/node_modules/rxjs/dist/esm5/internal/operators/takeWhile.js

14 lines
582 B
JavaScript
Raw Normal View History

2022-04-07 07:06:43 +00:00
import { operate } from '../util/lift';
import { createOperatorSubscriber } from './OperatorSubscriber';
export function takeWhile(predicate, inclusive) {
if (inclusive === void 0) { inclusive = false; }
return operate(function (source, subscriber) {
var index = 0;
source.subscribe(createOperatorSubscriber(subscriber, function (value) {
var result = predicate(value, index++);
(result || inclusive) && subscriber.next(value);
!result && subscriber.complete();
}));
});
}
//# sourceMappingURL=takeWhile.js.map