Comparisons\any()

higher-order predicate variadic returns Closure returns bool pure
...(T → bool) → (T → bool)
At a glance — Alias of groupOr. Reads naturally: "any of these predicates".

Creates a predicate Closure that is true when at least one of the bound predicates returns true for the input value. Alias of groupOr.

/**
  * @param callable(mixed):bool ...$callables
  * @return Closure(mixed):bool
  */
Comparisons\any(callable ...$callables): Closure

Returned Closure

When Comparisons\any() is called, it returns the following Closure which can be used like a regular function.

/**
  * @param mixed $value
  * @return bool
  */
$function ($value): bool

Examples

Partial Application

This can be used to create a simple closure which can be used as a regular function.

$positiveOrZero = Comparisons\any(
  Comparisons\isGreaterThan(0),
  Comparisons\isEqualTo(0)
);

var_dump($positiveOrZero(5));  // true
var_dump($positiveOrZero(0));  // true
var_dump($positiveOrZero(-1)); // false

Details

Comparisons Functions

Releated Combinators Functions