import { IndexedPredicate } from "../types/IndexedPredicate"; import { TypeGuardPredicate } from "../types/TypeGuardPredicate"; /** * Filters items from a source iterable using a predicate, optionally narrowing the element type. * * @typeParam T - Element type produced by the source iterable. * @typeParam S - Narrowed element type when `pred` acts as a type guard. * @param pred - Predicate invoked with each element and its index to determine inclusion. * @returns A transformer that yields every element for which `pred` returns a truthy value. * @throws Error Rethrows any error thrown by `pred`. * @example * ```ts * const odds = [ * ...pipeInto( * [1, 2, 3, 4], * filter((value) => value % 2 === 1) * ), * ]; * console.log(odds); // [1, 3] * ``` */ export declare function filter(pred: TypeGuardPredicate): (src: Iterable) => Iterable; export declare function filter(pred: IndexedPredicate): (src: Iterable) => Iterable; /** * Filters items from a source iterable using a predicate, optionally narrowing the element type. * * @typeParam T - Element type produced by the source iterable. * @typeParam S - Narrowed element type when `pred` acts as a type guard. * @param src - Source iterable evaluated synchronously. * @param pred - Predicate invoked with each element and its index to determine inclusion. * @returns A deferred iterable yielding every element for which `pred` returns a truthy value. * @throws Error Rethrows any error thrown by `pred`. * @example * ```ts * const odds = [..._filter([1, 2, 3, 4], (value) => value % 2 === 1)]; * console.log(odds); // [1, 3] * ``` */ export declare function _filter(src: Iterable, pred: TypeGuardPredicate): Iterable; export declare function _filter(src: Iterable, pred: IndexedPredicate): Iterable;