@tempots/std

allElements() function

Checks if all elements in an array satisfy a given predicate.

Signature:

allElements: (arr: T[], predicate: (v: T) => boolean) => boolean

Parameters

Parameter

Type

Description

arr

T[]

The array to check.

predicate

(v: T) => boolean

The predicate function to apply to each element.

Returns: boolean

true if all elements satisfy the predicate, false otherwise.