not
See also: hooks/iff hooks/iffElse predicates/every predicates/some
Negates a sync or async predicate function, inverting its boolean result. Useful for composing conditions like "not external" or "not multi".
import { not } from 'feathers-utils/predicates';Example
import { iff, not, isProvider } from 'feathers-utils/predicates'
app.service('users').hooks({
before: { all: [iff(not(isProvider('server')), authenticate('jwt'))] }
})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
/**
* Negates a sync or async predicate function, inverting its boolean result.
* Useful for composing conditions like "not external" or "not multi".
*
* @example
* ```ts
*
*
* app.service('users').hooks({
* before: { all: [iff(not(isProvider('server')), authenticate('jwt'))] }
* })
* ```
*
* @see https://utils.feathersjs.com/predicates/not.html
*/
export declare const not: <H extends HookContext = HookContext>(
predicate: PredicateFn<H>,
) => PredicateFn<H>| Argument | Type | Description |
|---|---|---|
| predicate | PredicateFn<H> |
