Skip to content

any

any<A>(predicates): Predicate<A>

Defined in: Core/Predicate.ts:145

Combines an array of predicates with OR: passes when at least one holds. Returns false for an empty array.

A

readonly Predicate<A>[]

Predicate<A>

const acceptedFormats: Predicate<string>[] = [
  s => s.endsWith(".jpg"),
  s => s.endsWith(".png"),
  s => s.endsWith(".webp"),
];

Predicate.any(acceptedFormats)("photo.jpg");   // true
Predicate.any(acceptedFormats)("photo.gif");   // false
Predicate.any([])("anything");                 // false