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

22 lines
822 B
JavaScript
Raw Normal View History

2022-04-07 07:06:43 +00:00
import { createOperatorSubscriber } from './OperatorSubscriber';
export function scanInternals(accumulator, seed, hasSeed, emitOnNext, emitBeforeComplete) {
return function (source, subscriber) {
var hasState = hasSeed;
var state = seed;
var index = 0;
source.subscribe(createOperatorSubscriber(subscriber, function (value) {
var i = index++;
state = hasState
?
accumulator(state, value, i)
:
((hasState = true), value);
emitOnNext && subscriber.next(state);
}, emitBeforeComplete &&
(function () {
hasState && subscriber.next(state);
subscriber.complete();
})));
};
}
//# sourceMappingURL=scanInternals.js.map