Toolbox-XToolbox-X

Calculation Methods

Methods for calculating pagination offsets, total pages, and metadata.

offset() / getOffset() / skipCount()

Signature

offset(): number
getOffset(): number // alias
skipCount(): number // alias

Returns

  • number: Items to skip for current page.

Formula

(currentPage - 1) * itemsPerPage

Example

playground.ts

totalPages()

Signature

totalPages(): number

Returns

  • number: Total page count.

Formula

Math.ceil(totalItems / itemsPerPage)

Example

playground.ts

getMeta()

Signature

getMeta(): PaginatorMeta

Returns

  • PaginatorMeta: Complete pagination metadata.
interface PaginatorMeta {
  totalItems: number;
  currentPage: number;
  itemsPerPage: number;
  totalPages: number;
  hasPrev: boolean;
  hasNext: boolean;
  isFirst: boolean;
  isLast: boolean;
  offset: number;
}

Example

playground.ts

Last updated: Sun, Jun 14, 2026 07:15:25PM (UTC)

On this page