isguard-ts
    Preparing search index...

    Function isArray

    • Creates an ArrayTypeGuard that checks that the value is an array and all elements match isValue.

      Can be shortened with TypeGuard.array.

      Type Parameters

      • T

        The type of elements in the array

      Parameters

      • isValue: TypeGuard<T>

        The type guard for individual array elements

      Returns ArrayTypeGuard<T>

      A type guard for T[]

      const isNumberArray = isArray(isNumber); // or isNumber.array()

      isNumberArray([1, 2, 3]); // true
      isNumberArray([1, "hello"]); // false