Sha256: a1892cf3b386d3518e5bb357cd3e045d253612cfdcd4ed5cd412f18943e6ea87

Contents?: true

Size: 1.94 KB

Versions: 49

Compression:

Stored size: 1.94 KB

Contents

import { filter as higherOrderFilter } from '../operators/filter';
/* tslint:enable:max-line-length */
/**
 * Filter items emitted by the source Observable by only emitting those that
 * satisfy a specified predicate.
 *
 * <span class="informal">Like
 * [Array.prototype.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter),
 * it only emits a value from the source if it passes a criterion function.</span>
 *
 * <img src="./img/filter.png" width="100%">
 *
 * Similar to the well-known `Array.prototype.filter` method, this operator
 * takes values from the source Observable, passes them through a `predicate`
 * function and only emits those values that yielded `true`.
 *
 * @example <caption>Emit only click events whose target was a DIV element</caption>
 * var clicks = Rx.Observable.fromEvent(document, 'click');
 * var clicksOnDivs = clicks.filter(ev => ev.target.tagName === 'DIV');
 * clicksOnDivs.subscribe(x => console.log(x));
 *
 * @see {@link distinct}
 * @see {@link distinctUntilChanged}
 * @see {@link distinctUntilKeyChanged}
 * @see {@link ignoreElements}
 * @see {@link partition}
 * @see {@link skip}
 *
 * @param {function(value: T, index: number): boolean} predicate A function that
 * evaluates each value emitted by the source Observable. If it returns `true`,
 * the value is emitted, if `false` the value is not passed to the output
 * Observable. The `index` parameter is the number `i` for the i-th source
 * emission that has happened since the subscription, starting from the number
 * `0`.
 * @param {any} [thisArg] An optional argument to determine the value of `this`
 * in the `predicate` function.
 * @return {Observable} An Observable of values from the source that were
 * allowed by the `predicate` function.
 * @method filter
 * @owner Observable
 */
export function filter(predicate, thisArg) {
    return higherOrderFilter(predicate, thisArg)(this);
}
//# sourceMappingURL=filter.js.map

Version data entries

49 entries across 49 versions & 4 rubygems

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