UNPKG

931 BTypeScriptView Raw
1import { IterableX } from './iterablex';
2/**
3 * Generates an iterable sequence by running a state-driven loop producing the sequence's elements.
4 *
5 * @export
6 * @template TState The type of the state used in the generator loop.
7 * @template TResult The type of the elements in the produced sequence.
8 * @param {TState} initialState The initial state.
9 * @param {((value: TState) => boolean)} condition Condition to terminate generation (upon returning false).
10 * @param {((value: TState) => TState)} iterate Iteration step function.
11 * @param {((value: TState) => TResult)} resultSelector Selector function for results produced in
12 * the sequence.
13 * @returns {IterableX<TResult>} The generated iterable sequence.
14 */
15export declare function generate<TState, TResult>(initialState: TState, condition: (value: TState) => boolean, iterate: (value: TState) => TState, resultSelector: (value: TState) => TResult): IterableX<TResult>;