Function paginateDocuments

Resolves the documents from an async generator and paginates them.

  • Type Parameters

    • T extends unknown

    Parameters

    • iterator: AsyncGenerator<T | T[], void, unknown>

      The async generator to resolve documents from.

    • limit: number
    • offset: number

    Returns Promise<T[]>

    • A promise that resolves to the flattened array of documents.