Debian Codegraph @

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

raw
1 import { createOperatorSubscriber } from './OperatorSubscriber';
2 export function scanInternals(accumulator, seed, hasSeed, emitOnNext, emitBeforeComplete) {
3 return (source, subscriber) => {
4 let hasState = hasSeed;
5 let state = seed;
6 let index = 0;
7 source.subscribe(createOperatorSubscriber(subscriber, (value) => {
8 const i = index++;
9 state = hasState
10 ?
11 accumulator(state, value, i)
12 :
13 ((hasState = true), value);
14 emitOnNext && subscriber.next(state);
15 }, emitBeforeComplete &&
16 (() => {
17 hasState && subscriber.next(state);
18 subscriber.complete();
19 })));
20 };
21 }
22 //# sourceMappingURL=scanInternals.js.map