Function handleCurriedAsynchronousIterable

  • Takes a generator for iterables, then a generator for async iterables and last 2 iterables, using the proper generator automatically.

    Example

    const handle = handleCurriedAsynchronousIterable(
    iterable2 => iterable1 => function* () {
    yield* iterable2;
    yield* iterable1;
    }
    )(
    iterable2 => iterable1 => async function* () {
    yield* iterable2;
    yield* iterable1;
    }
    );

    handle(nonAsyncIterable)(nonAsyncIterable); // IterableIterator
    handle(asyncIterable)(nonAsyncIterable); // AsyncIterableIterator

    Returns

    Curried function with iterator in context.

    Type Parameters

    • Iterable2Item = unknown

    • Iterable1Item = unknown

    • Output = unknown

    Parameters

    • iterator: ((iterable2: Iterable<Iterable2Item>) => ((iterable1: Iterable<Iterable1Item>) => (() => Generator<Output, void, void>)))

      Function to be used with non async iterables.

        • (iterable2: Iterable<Iterable2Item>): ((iterable1: Iterable<Iterable1Item>) => (() => Generator<Output, void, void>))
        • Parameters

          • iterable2: Iterable<Iterable2Item>

          Returns ((iterable1: Iterable<Iterable1Item>) => (() => Generator<Output, void, void>))

            • (iterable1: Iterable<Iterable1Item>): (() => Generator<Output, void, void>)
            • Parameters

              • iterable1: Iterable<Iterable1Item>

              Returns (() => Generator<Output, void, void>)

                • (): Generator<Output, void, void>
                • Returns Generator<Output, void, void>

    Returns ((asyncIterator: ((iterable2: AsynchronousIterable<Iterable2Item>) => ((iterable1: AsynchronousIterable<Iterable1Item>) => (() => AsyncGenerator<Output, void, void>)))) => (<Iterable2>(iterable2: Iterable2) => (<Iterable1>(iterable1: Iterable1) => Iterable2 extends AsyncIterable<Iterable2Item> ? AsyncIterableIterator<Output> : Iterable1 extends AsyncIterable<Iterable1Item> ? AsyncIterableIterator<Output> : IterableIterator<Output>)))

      • (asyncIterator: ((iterable2: AsynchronousIterable<Iterable2Item>) => ((iterable1: AsynchronousIterable<Iterable1Item>) => (() => AsyncGenerator<Output, void, void>)))): (<Iterable2>(iterable2: Iterable2) => (<Iterable1>(iterable1: Iterable1) => Iterable2 extends AsyncIterable<Iterable2Item> ? AsyncIterableIterator<Output> : Iterable1 extends AsyncIterable<Iterable1Item> ? AsyncIterableIterator<Output> : IterableIterator<Output>))
      • Parameters

        • asyncIterator: ((iterable2: AsynchronousIterable<Iterable2Item>) => ((iterable1: AsynchronousIterable<Iterable1Item>) => (() => AsyncGenerator<Output, void, void>)))
            • (iterable2: AsynchronousIterable<Iterable2Item>): ((iterable1: AsynchronousIterable<Iterable1Item>) => (() => AsyncGenerator<Output, void, void>))
            • Parameters

              • iterable2: AsynchronousIterable<Iterable2Item>

              Returns ((iterable1: AsynchronousIterable<Iterable1Item>) => (() => AsyncGenerator<Output, void, void>))

                • (iterable1: AsynchronousIterable<Iterable1Item>): (() => AsyncGenerator<Output, void, void>)
                • Parameters

                  • iterable1: AsynchronousIterable<Iterable1Item>

                  Returns (() => AsyncGenerator<Output, void, void>)

                    • (): AsyncGenerator<Output, void, void>
                    • Returns AsyncGenerator<Output, void, void>

        Returns (<Iterable2>(iterable2: Iterable2) => (<Iterable1>(iterable1: Iterable1) => Iterable2 extends AsyncIterable<Iterable2Item> ? AsyncIterableIterator<Output> : Iterable1 extends AsyncIterable<Iterable1Item> ? AsyncIterableIterator<Output> : IterableIterator<Output>))

          • <Iterable2>(iterable2: Iterable2): (<Iterable1>(iterable1: Iterable1) => Iterable2 extends AsyncIterable<Iterable2Item> ? AsyncIterableIterator<Output> : Iterable1 extends AsyncIterable<Iterable1Item> ? AsyncIterableIterator<Output> : IterableIterator<Output>)
          • Type Parameters

            • Iterable2 extends AsynchronousIterable<Iterable2Item>

            Parameters

            • iterable2: Iterable2

            Returns (<Iterable1>(iterable1: Iterable1) => Iterable2 extends AsyncIterable<Iterable2Item> ? AsyncIterableIterator<Output> : Iterable1 extends AsyncIterable<Iterable1Item> ? AsyncIterableIterator<Output> : IterableIterator<Output>)

              • <Iterable1>(iterable1: Iterable1): Iterable2 extends AsyncIterable<Iterable2Item> ? AsyncIterableIterator<Output> : Iterable1 extends AsyncIterable<Iterable1Item> ? AsyncIterableIterator<Output> : IterableIterator<Output>
              • Type Parameters

                • Iterable1 extends AsynchronousIterable<Iterable1Item>

                Parameters

                • iterable1: Iterable1

                Returns Iterable2 extends AsyncIterable<Iterable2Item> ? AsyncIterableIterator<Output> : Iterable1 extends AsyncIterable<Iterable1Item> ? AsyncIterableIterator<Output> : IterableIterator<Output>