Sha256: f4f1097013ee31d194ab14fadb10fc557fb2444e6158e240e2cf7db7208763ec

Contents?: true

Size: 1.83 KB

Versions: 49

Compression:

Stored size: 1.83 KB

Contents

"use strict";
var takeWhile_1 = require('../operators/takeWhile');
/**
 * Emits values emitted by the source Observable so long as each value satisfies
 * the given `predicate`, and then completes as soon as this `predicate` is not
 * satisfied.
 *
 * <span class="informal">Takes values from the source only while they pass the
 * condition given. When the first value does not satisfy, it completes.</span>
 *
 * <img src="./img/takeWhile.png" width="100%">
 *
 * `takeWhile` subscribes and begins mirroring the source Observable. Each value
 * emitted on the source is given to the `predicate` function which returns a
 * boolean, representing a condition to be satisfied by the source values. The
 * output Observable emits the source values until such time as the `predicate`
 * returns false, at which point `takeWhile` stops mirroring the source
 * Observable and completes the output Observable.
 *
 * @example <caption>Emit click events only while the clientX property is greater than 200</caption>
 * var clicks = Rx.Observable.fromEvent(document, 'click');
 * var result = clicks.takeWhile(ev => ev.clientX > 200);
 * result.subscribe(x => console.log(x));
 *
 * @see {@link take}
 * @see {@link takeLast}
 * @see {@link takeUntil}
 * @see {@link skip}
 *
 * @param {function(value: T, index: number): boolean} predicate A function that
 * evaluates a value emitted by the source Observable and returns a boolean.
 * Also takes the (zero-based) index as the second argument.
 * @return {Observable<T>} An Observable that emits the values from the source
 * Observable so long as each value satisfies the condition defined by the
 * `predicate`, then completes.
 * @method takeWhile
 * @owner Observable
 */
function takeWhile(predicate) {
    return takeWhile_1.takeWhile(predicate)(this);
}
exports.takeWhile = takeWhile;
//# sourceMappingURL=takeWhile.js.map

Version data entries

49 entries across 49 versions & 4 rubygems

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