UNET API - v0.0.0
    Preparing search index...

    Function paginate

    • Walks every page of a list call, cursor- or offset-based:

      for await (const page of paginate((p) => unet.api.feed({ cursor: p.cursor }))) show(page.posts);
      for await (const page of paginate((p) => unet.api.followers("alice", { offset: p.offset }))) show(page.users);

      Stops when the server returns no next position (or the same one twice). maxPages caps the walk.

      Type Parameters

      • T extends { nextCursor?: string | null; nextOffset?: number | null }

      Parameters

      • load: (position: { cursor?: string; offset?: number }) => Promise<T>
      • options: { maxPages?: number } = {}

      Returns AsyncGenerator<T, void, undefined>