Class Paginator<T>

Utility to paginate data.

Type Parameters

  • T

Hierarchy

  • Paginator

Implements

  • Iterable<T>

Constructors

Properties

elements: T[]

All the items passed to the paginator.

internalCurrentPage: number = 1

The internal current page. This is always at least 1.

internalItemsPerPage: number = 10

The internal tacker for the items per page count.

items: T[] = []

Current page's items.

wrapsAround: boolean

Boolean indicating whether the paginator should repeat or not.

Accessors

  • get hasPrevious(): boolean
  • Determine whether the paginator has a previous page.

    Returns boolean

Methods

  • Enable array like behaviour.

    Returns Iterator<T, any, undefined>

  • Determine whether the paginator has the given item.

    Parameters

    • item: T

    Returns boolean

  • Determine whether the given item is on page based on deep equality.

    Parameters

    • item: T

    Returns boolean

  • Private

    Get the page number where the item first occurs. If not found return -1

    Parameters

    • item: T

    Returns number

  • Add one or more items to the end of the paginator. Returns the new length of the paginator.

    Parameters

    • Rest ...items: T[]

    Returns number

  • Add one or more items to the beginning of the paginator. Returns the new length of the paginator.

    Parameters

    • Rest ...items: T[]

    Returns number

Generated using TypeDoc