• Determines whether all elements of a sequence satisfy a condition.

    Type Parameters

    • TSource

    Parameters

    • src: Iterable<TSource>

      An Enumerable that contains the elements to apply the predicate to.

    • condition: (item: TSource, index: number) => boolean

      A function to test each element for a condition.

    Returns boolean

    true if every element of the source sequence passes the test in the specified predicate, or if the sequence is empty; otherwise, false.

    IEnumerable.all for fluent syntax.

    const numbers = [1, 2, 3, 4];
    const areAllNumbersEven = all(numbers, x => x % 2 === 0);