Function every

  • Checks if all elements in the source satisfy the predicate.

    Type Parameters

    • T

      Type of items in the source.

    Parameters

    • predicate: PredicateFunction<T>

      Predicate function to determine if an element satisfies a condition.

    Returns CollectorFunction<T, boolean>

    Collector that checks if all elements in the source satisfy the predicate.

    const result = all<number>((x) => x > 0)([1, 2, 3]);
    console.log(result); // true