Function all

  • Return true if, for each element of the iterable, the result of executing condition is truthy.

    Type Parameters

    • Iter extends AnyIt<unknown>
    • V extends unknown

    Parameters

    • iter: Iter

      A sync or async iterable.

    • condition: V | Matcher<V>

      Either a function that accepts an element of the iterable and returns a boolean, or directly a value to check equality against.

    Returns AnyItResult<Iter, boolean>

    Example

    // Returns true
    it.all([1, 2, 3], x => x < 10)

    Example

    // Returns true
    it.all([1, 1, 1], 1)
  • Pipe version of all.

    Type Parameters

    • Iter extends AnyIt<unknown>
    • V extends unknown

    Parameters

    • condition: V | Matcher<V>

    Returns CurriedAnyItResult<Iter, boolean>

    Example

    // Returns true
    it.pipe(it.range(2), it.all(x => x < 4))