UNPKG

@idealic/poker-engine

Version:

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

24 lines 1.58 kB
import { writer } from './lib/writer'; import { AnyIterable, MaybePromise } from './types'; export type Branches = Record<string, (input: AnyIterable<any>) => AnyIterable<any>>; export type BranchValues<R extends Branches> = { [key in keyof R]?: (R[key] extends (input: AnyIterable<infer T>) => any ? T : never) | undefined; }; export type BranchWriters<R extends Branches> = { [key in keyof R]: ReturnType<typeof writer>; }; /** * Partition function takes a splitter function and multiple processors. * The splitter function splits each input item into a tuple of parts. * Items returned from splitter get routed to processors by index * * Backpressure is provided both by downstream steps and by branching steps. * * @param splitter Function that splits each input item into a tuple * @param processors Processing functions, one for each position in the tuple * @returns A function that takes an iterable input and returns processed results */ export declare function _dispatch<T, R extends Branches>(iterator: AnyIterable<T>, splitter: (item: T) => MaybePromise<BranchValues<R>>, branches: R, concurrency?: number): AsyncGenerator<T>; export declare function dispatch<T, R extends Branches>(input: AnyIterable<T>, splitter: (item: T) => MaybePromise<BranchValues<R>>, branches: R, concurrency?: number): AsyncGenerator<T>; export declare function dispatch<T, R extends Branches>(splitter: (item: T) => MaybePromise<BranchValues<R>>, branches: R, concurrency?: number): (iterator: AnyIterable<T>) => AsyncGenerator<T>; //# sourceMappingURL=dispatch.d.ts.map