isPaginated
See also: utils/getPaginate
Checks if the current find operation is paginated by inspecting params.paginate and the service's pagination options via getPaginate. Returns false for all methods other than find or when pagination is disabled.
import { isPaginated } from 'feathers-utils/predicates';Example
import { iff, isPaginated } from 'feathers-utils/predicates'
app.service('users').hooks({
after: { find: [iff(isPaginated, addTotalCountHeader())] }
})Hooks for predicates
| Hook | Description |
|---|---|
iff | Conditionally executes a series of hooks when the predicate is truthy.
The predicate can be a boolean value or a sync/async function.
Supports an |
iffElse | Executes one array of hooks when the predicate is truthy, or another array when it is falsy.
The predicate can be a boolean or a sync/async function.
Unlike |
skippable | Wraps a hook so it can be conditionally skipped based on a predicate.
When the predicate returns |
throwIf | Throws a |
unless | Executes a series of hooks when the predicate is falsy --- the inverse of |
Type declaration
Show Type Declarations
/**
* Checks if the current `find` operation is paginated by inspecting
* `params.paginate` and the service's pagination options via `getPaginate`.
* Returns `false` for all methods other than `find` or when pagination is disabled.
*
* @example
* ```ts
*
*
* app.service('users').hooks({
* after: { find: [iff(isPaginated, addTotalCountHeader())] }
* })
* ```
*
* @see https://utils.feathersjs.com/predicates/is-paginated.html
*/
export declare const isPaginated: <H extends HookContext = HookContext>(
context: H,
) => boolean| Argument | Type | Description |
|---|---|---|
| context | H |
