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