For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /reference/predicate/allPass.md.

allPass

Returns a predicate that checks if a value satisfies ALL predicates.

When every input is a type guard, the result narrows to the intersection of every guard's target type. Plain boolean predicates contribute nothing to the narrowing (they fall back to no-op).

const isPositiveEven = allPass([(n: number) => n > 0, (n: number) => n % 2 === 0])
isPositiveEven(4) // true

const isNonEmptyString = allPass([isString, isNotEmpty])
if (isNonEmptyString(x)) {
  // x is narrowed to string here
}

Usage

allPass(predicates: ReadonlyArray<(value: unknown) => boolean>)

Returns a predicate that checks if a value satisfies ALL predicates.

When every input is a type guard, the result narrows to the intersection of every guard's target type. Plain boolean predicates contribute nothing to the narrowing (they fall back to no-op).

import { allPass } from 'massaman'
// or:  import { allPass } from 'massaman/predicate'

const isPositiveEven = allPass([(n: number) => n > 0, (n: number) => n % 2 === 0])
isPositiveEven(4) // true

const isNonEmptyString = allPass([isString, isNotEmpty])
if (isNonEmptyString(x)) {
  // x is narrowed to string here
}

Parameters

predicatesReadonlyArray<(value: unknown) => boolean>required

the predicates to combine.

Returns

a predicate that returns true only when every supplied predicate passes.

(value: unknown) => boolean