Function every

Checks if every element in an array passes a given predicate.

const areAllPositive = every((x: number) => x > 0);
const a = areAllPositive([1, 2, 3]); // true
const b = areAllPositive([-1, 0, 1]); // false
  • Type Parameters

    • A

    Parameters

    • fn: ((value: A) => boolean)
        • (value): boolean
        • Parameters

          • value: A

          Returns boolean

    Returns (<S>(source: S) => boolean)

      • <S>(source): boolean
      • Type Parameters

        • S extends readonly A[]

        Parameters

        • source: S

        Returns boolean