isConsistent2DArray
This is the check to run before Range#setValues, which rejects a ragged matrix with a message that names neither the offending row nor the reason. Everything is2DArray requires holds here as well — a non-empty array of arrays — plus the rule that every row is as wide as the first.
As a TypeScript type predicate it narrows the value to Array<Array<unknown>> inside the branch.
Parameters
Parameter | Type | Description |
|---|---|---|
|
| The value to check. |
Returns
boolean — true if the value is a non-empty array of arrays of equal length; otherwise false.
In TypeScript the guard narrows arr to Array<Array<unknown>> inside the branch.
Examples
Uniform rows, ragged rows, and non-matrices
Before writing to a range
See also
is2DArray— the shape check without the row length rule.nonConsistent2DArray— the same test, negated.requireConsistent2DArray— throws, and names the offending row.
Source
This documentation was generated with AI (Claude) from the library's source code.