Skip to main content

every

Callable

  • every<T>(xs: Traversable<T, unknown>, predicate: (x: T) => boolean): boolean

  • The function tests whether all elements in the Traversable satisfy the predicate.

    Example

    all([true, true, true], identity)
    // => true

    all([10, 11, 5], x => x > 10)
    // => false

    all([true, false, true], identity)
    // => false

    all([], identity)
    // => true

    Alternatives

    Proposals

    @see

    Type parameters

    • T

      The element type.

    Parameters

    • xs: Traversable<T, unknown>

      The values to check.

    • predicate: (x: T) => boolean

      The predicate that will be checked on every element.

    Returns boolean

    Whether all elements satisfy the predicate.