combine
Source Code | DocumentationSequentially executes multiple hooks, passing the updated context from one to the next. Returns a single hook function that runs the entire chain. If any hook throws, the error is annotated with the current hook context.
ts
import { combine } from 'feathers-utils/hooks';Example
ts
import { combine } from 'feathers-utils/hooks'
const combinedHook = combine(hookA(), hookB(), hookC())
app.service('users').hooks({ before: { create: [combinedHook] } })Type declaration
Show Type Declarations
ts
/**
* Sequentially executes multiple hooks, passing the updated context from one to the next.
* Returns a single hook function that runs the entire chain. If any hook throws,
* the error is annotated with the current hook context.
*
* @example
* ```ts
*
*
* const combinedHook = combine(hookA(), hookB(), hookC())
* app.service('users').hooks({ before: { create: [combinedHook] } })
* ```
*
* @see https://utils.feathersjs.com/utils/combine.html
*/
export declare function combine<H extends HookContext = HookContext>(
...serviceHooks: HookFunction<H>[]
): (context: H) => Promise<H>| Argument | Type | Description |
|---|---|---|
| serviceHooks | HookFunction<H>[] |
| type | methods | multi |
|---|---|---|
| before, after | all | yes |
