Function arrEvery

  • Returns true if the predicate is satisfied for every element of the passed array; otherwise false.

    Type Parameters

    • T

      The type of elements in the array.

    Parameters

    • input: T[]

      The array

    • predicate: ArrayPredicate<T>

      A predicate callback function

    Returns boolean

    Returns true if all elements pass the predicate check, else false.

    Example

    const numbers = [1, 2, 3, 4, 5];
    const isEven = (num) => num % 2 === 0;
    arrEvery(numbers, isEven);
    //=> false
    arrEvery(numbers, (num) => num > 0);
    //=> true

Generated using TypeDoc