Sha256: 09110956734c026a569fc56aea351557093e5223eb90af26b2d385a818b4f7c4

Contents?: true

Size: 1.7 KB

Versions: 49

Compression:

Stored size: 1.7 KB

Contents

import { Subscriber } from '../Subscriber';
/**
 * Returns an Observable that skips all items emitted by the source Observable as long as a specified condition holds
 * true, but emits all further source items as soon as the condition becomes false.
 *
 * <img src="./img/skipWhile.png" width="100%">
 *
 * @param {Function} predicate - A function to test each item emitted from the source Observable.
 * @return {Observable<T>} An Observable that begins emitting items emitted by the source Observable when the
 * specified predicate becomes false.
 * @method skipWhile
 * @owner Observable
 */
export function skipWhile(predicate) {
    return (source) => source.lift(new SkipWhileOperator(predicate));
}
class SkipWhileOperator {
    constructor(predicate) {
        this.predicate = predicate;
    }
    call(subscriber, source) {
        return source.subscribe(new SkipWhileSubscriber(subscriber, this.predicate));
    }
}
/**
 * We need this JSDoc comment for affecting ESDoc.
 * @ignore
 * @extends {Ignored}
 */
class SkipWhileSubscriber extends Subscriber {
    constructor(destination, predicate) {
        super(destination);
        this.predicate = predicate;
        this.skipping = true;
        this.index = 0;
    }
    _next(value) {
        const destination = this.destination;
        if (this.skipping) {
            this.tryCallPredicate(value);
        }
        if (!this.skipping) {
            destination.next(value);
        }
    }
    tryCallPredicate(value) {
        try {
            const result = this.predicate(value, this.index++);
            this.skipping = Boolean(result);
        }
        catch (err) {
            this.destination.error(err);
        }
    }
}
//# sourceMappingURL=skipWhile.js.map

Version data entries

49 entries across 49 versions & 4 rubygems

Version Path
ilog-0.4.1 node_modules/rxjs/_esm2015/operators/skipWhile.js
ilog-0.4.0 node_modules/rxjs/_esm2015/operators/skipWhile.js
ilog-0.3.3 node_modules/rxjs/_esm2015/operators/skipWhile.js
govuk_publishing_components-18.0.0 node_modules/rxjs/_esm2015/operators/skipWhile.js
govuk_publishing_components-17.21.0 node_modules/rxjs/_esm2015/operators/skipWhile.js
govuk_publishing_components-17.20.0 node_modules/rxjs/_esm2015/operators/skipWhile.js
govuk_publishing_components-17.19.1 node_modules/rxjs/_esm2015/operators/skipWhile.js
govuk_publishing_components-17.19.0 node_modules/rxjs/_esm2015/operators/skipWhile.js
govuk_publishing_components-17.18.0 node_modules/rxjs/_esm2015/operators/skipWhile.js
govuk_publishing_components-17.17.0 node_modules/rxjs/_esm2015/operators/skipWhile.js
govuk_publishing_components-17.16.0 node_modules/rxjs/_esm2015/operators/skipWhile.js
govuk_publishing_components-17.15.0 node_modules/rxjs/_esm2015/operators/skipWhile.js
govuk_publishing_components-17.14.0 node_modules/rxjs/_esm2015/operators/skipWhile.js
govuk_publishing_components-17.13.0 node_modules/rxjs/_esm2015/operators/skipWhile.js
govuk_publishing_components-17.12.2 node_modules/rxjs/_esm2015/operators/skipWhile.js
govuk_publishing_components-17.12.1 node_modules/rxjs/_esm2015/operators/skipWhile.js
govuk_publishing_components-17.12.0 node_modules/rxjs/_esm2015/operators/skipWhile.js
govuk_publishing_components-17.11.0 node_modules/rxjs/_esm2015/operators/skipWhile.js
govuk_publishing_components-17.10.0 node_modules/rxjs/_esm2015/operators/skipWhile.js
govuk_publishing_components-17.9.0 node_modules/rxjs/_esm2015/operators/skipWhile.js