tguard-js
    Preparing search index...

    Function isMatrix

    • Determines whether the provided value is a numeric matrix.

      In mathematics, a matrix is a rectangular array of numbers or other mathematical objects with elements or entries arranged in rows and columns.

      From Wikipedia (https://en.wikipedia.org/wiki/Matrix_(mathematics)).

      Parameters

      • x: unknown

        The value to validate.

      Returns x is number[][]

      true if the value is an array of number arrays.

      A value is considered a matrix if:

      • it is an array
      • every element is an array
      • every nested value is a number
      Value Result
      [] false
      [[]] true
      [[1, 2], [3, 4]] true
      [[1], [2], [3]] true
      [[1], [2, 3]] false
      [[1], ['a']] false
      [1, 2] false
      {} false

      1.1