UNPKG

917 BTypeScriptView Raw
1import { AsyncIterableX } from '../asynciterable';
2/**
3 * Filters a sequence of values based on a predicate.
4 * @param {Iterable<T | Promise<T>> | AsyncIterable<T>} source Source sequence.
5 * @param {function(value: T, index: number): boolean | Promise<boolean>} predicate A function to test each source element for a condition.
6 * @param {Object} [thisArg] Value to use as this when executing callback.
7 * @return {AsyncIterable<T>} Sequence that contains elements from the input sequence that satisfy the condition.
8 */
9export declare function filterAsync<T, S extends T>(source: Iterable<T | PromiseLike<T>> | AsyncIterable<T>, predicate: (value: T, index: number) => value is S, thisArg?: any): AsyncIterableX<S>;
10export declare function filterAsync<T>(source: Iterable<T | PromiseLike<T>> | AsyncIterable<T>, predicate: (value: T, index: number) => boolean | Promise<boolean>, thisArg?: any): AsyncIterableX<T>;