skippable
See also: predicates addSkip
Wrap a hook to make it skippable
import { skippable } from 'feathers-utils/hooks';Type declaration
/**
* Wrap a hook to make it skippable
*/
export declare const skippable: <H extends HookContext = HookContext>(
hook: HookFunction<H>,
predicate: PredicateFn<H>,
) => (context: H, next?: NextFunction) => void | H | Promise<void | H>| Argument | Type | Description |
|---|---|---|
| hook | HookFunction<H> | |
| predicate | PredicateFn<H> |
Predicates
skippable is a utility function that wraps a hook to make it skippable based on a passed predicate. This is useful when you want to conditionally skip the execution of a hook based on certain criteria, such as the presence of a specific parameter in the context.
'feathers-utils' provides a set of predicates that can be used with this utility.
everyReturn the and of a series of sync or async predicate functions.
isContextCheck if the context matches the given options.
isMultiutil to check if a hook is a multi hook:
- find: true
- get: false
- create:
context.datais an array - update: false
- patch:
context.id == null - remove:
context.id == null
isPaginatedutil to check if a hook is a paginated hook using getPaginate
isProviderCheck which transport provided the service call.
notNegate a predicate function.
shouldSkipUtil to detect if a hook should be skipped
Checks the params.skipHooks array for the hook name, type, or 'all'.
someReturn the or of a series of sync or async predicate functions.
