isMulti
Checks if the current hook context represents a multi operation. Returns true for find, for create with array data, and for patch/remove with id === null. Returns false for get and update.
import { isMulti } from 'feathers-utils/predicates';Example
import { iff, isMulti } from 'feathers-utils/predicates'
app.service('users').hooks({
before: { all: [iff(isMulti, rateLimitHook())] }
})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 hook context represents a multi operation.
* Returns `true` for `find`, for `create` with array data, and for `patch`/`remove`
* with `id === null`. Returns `false` for `get` and `update`.
*
* @example
* ```ts
*
*
* app.service('users').hooks({
* before: { all: [iff(isMulti, rateLimitHook())] }
* })
* ```
*
* @see https://utils.feathersjs.com/predicates/is-multi.html
*/
export declare const isMulti: <H extends HookContext = HookContext>(
context: H,
) => boolean| Argument | Type | Description |
|---|---|---|
| context | H |
