• Returns a generator that yields first argument (what) the number of times specified by the second argument (times). If times is not given, what is repeated indefinitely.

    Parameters

    • what: Iterable<any>
    • Optional times: number

    Returns Generator<any, void, unknown>

    Example

    import { repeat } from 'deleight/generational';
    const repeated = [...repeat([1, 2, 3], 4)];
    // [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]