@pwngh/economy-lab
    Preparing search index...

    Function paginate

    • One bounded page of an async stream: the rows in [offset, offset + limit), plus the full total. Drains the source — the total requires it — and offset rows shift under live writes, so this is for quiescent or snapshot-ish reads: consoles, ops scripts, tests. A live feed should iterate the stream and stop instead.

      Type Parameters

      • T

      Parameters

      • source: AsyncIterable<T>
      • page: { limit: number; offset: number }

      Returns Promise<{ rows: T[]; total: number }>