Skip to content

@serenity-is/corelib / any

Function: any()

any<TItem>(array, predicate): boolean

Defined in: src/compat/arrays-compat.ts:10

Tests whether any element in the array satisfies the predicate.

Type Parameters

TItem

TItem

Parameters

array

TItem[]

Array to test.

predicate

(x) => boolean

Function invoked per element; should return true for a match.

Returns

boolean

true if at least one element matches, otherwise false.

Deprecated

Prefer native Array.prototype.some — e.g. array.some(predicate). Retained as a any compat shim.

Example

any([1, 2, 3], x => x > 2); // true