@mantlebee/ts-data
    Preparing search index...

    Function pageItems

    • Cuts the page of a list, as a server would: page is 1-based, a page lower than 1 is read as the first one, a page beyond the last one is empty, not an error. totalItemsCount of the pagination is ignored: the list is the whole result. The list is never mutated; the result is always a new array.

      Type Parameters

      • TItem = any

      Parameters

      • items: List<TItem>

        Items to page, already filtered and sorted.

      • Optionalpagination: Pagination

        Page to cut; none for every item.

      Returns List<TItem>

      the items of the page; a copy of the list without pagination.

      const secondPage = pageItems(users, { itemsPerPage: 20, page: 2, totalItemsCount: 0 });