Instance Creation Methods
Methods for creating new Paginator instances with modified parameters.
withPage()
Signature
withPage(page: number): PaginatorParameters
| Parameter | Type | Description |
|---|---|---|
page | number | New current page number. |
Returns
Paginator: New instance with updated page. Clamps page between 1 and the last page. The original instance remains unchanged.
Example
playground.ts
withPerPage()
Signature
withPerPage(perPage: number): PaginatorParameters
| Parameter | Type | Description |
|---|---|---|
perPage | number | New items per page value. |
Returns
Paginator: New instance with updated items per page. Clamps value to minimum 1. Automatically adjusts current page if needed.
Example
playground.ts
withTotalItems()
Signature
withTotalItems(totalItems: number): PaginatorParameters
| Parameter | Type | Description |
|---|---|---|
totalItems | number | New total items count. |
Returns
Paginator: New instance with updated total. Clamps value to minimum 0. Automatically adjusts current page if needed.
Example
playground.ts
withOptions()
Signature
withOptions(options: Partial<PaginatorOptions>): PaginatorParameters
| Parameter | Type | Description |
|---|---|---|
options | Partial<PaginatorOptions> | Partial options to override. |
Returns
Paginator: New instance with merged options. Applies the same clamping rules as the constructor. Only provided values are updated.
Example
playground.ts
Last updated: Sun, Jun 14, 2026 07:15:25PM (UTC)
