Debian Codegraph @

node/rxjs/dist/esm5/internal/operators/skipLast.js

raw
1 import { identity } from '../util/identity';
2 import { operate } from '../util/lift';
3 import { createOperatorSubscriber } from './OperatorSubscriber';
4 export function skipLast(skipCount) {
5 return skipCount <= 0
6 ?
7 identity
8 : operate(function (source, subscriber) {
9 var ring = new Array(skipCount);
10 var seen = 0;
11 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
12 var valueIndex = seen++;
13 if (valueIndex < skipCount) {
14 ring[valueIndex] = value;
15 }
16 else {
17 var index = valueIndex % skipCount;
18 var oldValue = ring[index];
19 ring[index] = value;
20 subscriber.next(oldValue);
21 }
22 }));
23 return function () {
24 ring = null;
25 };
26 });
27 }
28 //# sourceMappingURL=skipLast.js.map