• Returns a Generator over the next 'count' items of the iterable or iterator. In most cases you will call this function with an iterator.

    If a firstValue is specified, it will be yielded first.

    Parameters

    • it: Iterable<any> | Iterator<any, any, undefined>
    • count: number
    • Optional firstValue: any

    Returns Generator<any, void, unknown>

    Example

    import { next, forceIterator } from 'deleight/generators';
    const it = forceIterator([1, 'a', 2, 'b', 3, 'c', 4, 'd']);
    const [num1, let1] = next(it, 2); // (1, 'a')
    const [num2, let2] = next(it, 2); // (2, 'b')