tguard-js
    Preparing search index...

    Function is2DArray

    • Determines whether the provided value is a two-dimensional array.

      Parameters

      • x: unknown

        The value to validate.

      Returns x is unknown[][]

      true if the value is a two-dimensional array.

      A value is considered a 2D array if:

      • it is an array
      • every element is also an array

      The inner array element types are not validated.

      Value Result
      [] false
      [[]] true
      [[1, 2], [3]] true
      [['a'], [1]] true
      [1, 2, 3] false
      {} false
      null false
      • Empty two-dimensional array are considered valid.
      • Inner arrays may contain values of any type.
      • This function checks only array nesting depth, not contents.

      1.1