Skip to content

getPaginate

utils
Source Code | Documentation

Resolves the active pagination options for the current hook context. Checks (in order): context.params.paginate, service.options.paginate, and context.params.adapter.paginate. Returns undefined if pagination is disabled.

ts
  import { 
getPaginate
} from 'feathers-utils/utils';

Example

ts
import { getPaginate } from 'feathers-utils/utils'

const paginate = getPaginate(context)
if (paginate) {
  console.log('Max items:', paginate.max)
}

Type declaration

Show Type Declarations
ts
/**
 * Resolves the active pagination options for the current hook context.
 * Checks (in order): `context.params.paginate`, `service.options.paginate`,
 * and `context.params.adapter.paginate`. Returns `undefined` if pagination is disabled.
 *
 * @example
 * ```ts
 *
 *
 * const paginate = getPaginate(context)
 * if (paginate) {
 *   console.log('Max items:', paginate.max)
 * }
 * ```
 *
 * @see https://utils.feathersjs.com/utils/get-paginate.html
 */
export declare const getPaginate: <H extends HookContext = HookContext>(
  context: H,
) => PaginationOptions | undefined
ArgumentTypeDescription
contextH

Released under the MIT License.