source: trip-planner-front/node_modules/rxjs/_esm2015/internal/operators/skipWhile.js@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.1 KB
Line 
1import { Subscriber } from '../Subscriber';
2export function skipWhile(predicate) {
3 return (source) => source.lift(new SkipWhileOperator(predicate));
4}
5class SkipWhileOperator {
6 constructor(predicate) {
7 this.predicate = predicate;
8 }
9 call(subscriber, source) {
10 return source.subscribe(new SkipWhileSubscriber(subscriber, this.predicate));
11 }
12}
13class SkipWhileSubscriber extends Subscriber {
14 constructor(destination, predicate) {
15 super(destination);
16 this.predicate = predicate;
17 this.skipping = true;
18 this.index = 0;
19 }
20 _next(value) {
21 const destination = this.destination;
22 if (this.skipping) {
23 this.tryCallPredicate(value);
24 }
25 if (!this.skipping) {
26 destination.next(value);
27 }
28 }
29 tryCallPredicate(value) {
30 try {
31 const result = this.predicate(value, this.index++);
32 this.skipping = Boolean(result);
33 }
34 catch (err) {
35 this.destination.error(err);
36 }
37 }
38}
39//# sourceMappingURL=skipWhile.js.map
Note: See TracBrowser for help on using the repository browser.