Allow to have one row matrix in CheckMatrix

This commit is contained in:
Andrii Barvynko 2021-03-26 12:03:39 +02:00
parent 8283d5cb10
commit c7fd4c4e0a

View file

@ -8,7 +8,7 @@
* Checks if an array can be used as a matrix. * Checks if an array can be used as a matrix.
* *
* A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows)
* have the same length. There must be at least two rows. This is an example matrix: * have the same length. This is an example matrix:
* *
* ``` * ```
* [ * [
@ -33,7 +33,7 @@
*/ */
var CheckMatrix = function (matrix) var CheckMatrix = function (matrix)
{ {
if (!Array.isArray(matrix) || matrix.length < 2 || !Array.isArray(matrix[0])) if (!Array.isArray(matrix) || !Array.isArray(matrix[0]))
{ {
return false; return false;
} }