Skip to content

Commit e240a1b

Browse files
fix(matrix): ✅ Properly flatten any matrix to an array
Matrix.toArray() will now properly flatten non-square matrices to an array.
1 parent 8841095 commit e240a1b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/matrix.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ export function toArray<T1, T2>(
236236
) {
237237
const array = [];
238238
for (let row = 0; row < matrix.length; row++) {
239-
for (let column = 0; column < matrix.length; column++) {
239+
for (let column = 0; column < matrix[row].length; column++) {
240240
const value = matrix[row][column];
241241
array.push(transform ? transform(value, { row, column }) : value);
242242
}

0 commit comments

Comments
 (0)