18 lines
No EOL
732 B
JavaScript
18 lines
No EOL
732 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.takeWhile = void 0;
|
|
var lift_1 = require("../util/lift");
|
|
var OperatorSubscriber_1 = require("./OperatorSubscriber");
|
|
function takeWhile(predicate, inclusive) {
|
|
if (inclusive === void 0) { inclusive = false; }
|
|
return lift_1.operate(function (source, subscriber) {
|
|
var index = 0;
|
|
source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
|
|
var result = predicate(value, index++);
|
|
(result || inclusive) && subscriber.next(value);
|
|
!result && subscriber.complete();
|
|
}));
|
|
});
|
|
}
|
|
exports.takeWhile = takeWhile;
|
|
//# sourceMappingURL=takeWhile.js.map
|