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/anyPass.md.

anyPass

Returns a predicate that checks if a value satisfies ANY predicate.

When every input is a type guard, the result narrows to the union of every guard's target type (since only one needs to match).

const isAdminOrOwner = anyPass([isAdmin, isOwner])
isAdminOrOwner(user)

const isStringOrNumber = anyPass([isString, isNumber])
if (isStringOrNumber(x)) {
  // x is narrowed to string | number here
}

Usage

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

Returns a predicate that checks if a value satisfies ANY predicate.

When every input is a type guard, the result narrows to the union of every guard's target type (since only one needs to match).

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

const isAdminOrOwner = anyPass([isAdmin, isOwner])
isAdminOrOwner(user)

const isStringOrNumber = anyPass([isString, isNumber])
if (isStringOrNumber(x)) {
  // x is narrowed to string | number here
}

Parameters

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

the predicates to combine.

Returns

a predicate that returns true when at least one supplied predicate passes.

(value: unknown) => boolean