every
See also: hooks/iff hooks/iffElse predicates/some predicates/not
Returns a predicate that is true only when all given predicates are true (logical AND). Supports both sync and async predicates. Short-circuits on the first false result. Undefined predicates in the list are skipped.
import { every } from 'feathers-utils/predicates';Example
import { iff, every, isProvider, isMulti } from 'feathers-utils/predicates'
app.service('users').hooks({
before: { all: [iff(every(isProvider('external'), isMulti), checkMulti())] }
})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
/**
* Returns a predicate that is `true` only when **all** given predicates are `true` (logical AND).
* Supports both sync and async predicates. Short-circuits on the first `false` result.
* Undefined predicates in the list are skipped.
*
* @example
* ```ts
*
*
* app.service('users').hooks({
* before: { all: [iff(every(isProvider('external'), isMulti), checkMulti())] }
* })
* ```
*
* @see https://utils.feathersjs.com/predicates/every.html
*/
export declare const every: <H extends HookContext = HookContext>(
...predicates: (PredicateFn<H> | undefined)[]
) => PredicateFn<H>| Argument | Type | Description |
|---|---|---|
| predicates | (PredicateFn<H> | undefined)[] |
