UNPKG

@idealic/poker-engine

Version:

Professional poker game engine and hand evaluator with built-in iterator utilities

22 lines 1.17 kB
/** * Functions for filtering elements of an iterable that match a predicate */ import { AnyIterable, MaybePromise } from './types'; /** * Internal implementation of async filter * * @param input Source iterable to filter * @param test Predicate function to test each item - can return boolean to filter, null to exclude, or any other value to transform */ type FilterFunction<T, R = T> = (value: Awaited<T> | T) => MaybePromise<boolean | null | R>; /** * Creates a function that filters elements of an iterable that match a predicate. * If the predicate returns boolean true, the original value is yielded. * If the predicate returns boolean false or null, the value is excluded. * If the predicate returns any other value, that value is yielded instead. */ export declare function filter<T, R = T>(input: AnyIterable<T>, test: FilterFunction<T, R>, concurrency?: number): AsyncGenerator<T | R>; export declare function filter<T, R = T>(test: FilterFunction<T, R>, concurrency?: number): (input: AnyIterable<T>) => AsyncGenerator<R extends boolean | null ? T : R>; export declare function identity<T>(item: T): T; export {}; //# sourceMappingURL=filter.d.ts.map