1.0.0 • Published 5 years ago
@definitelynotsam/matrix-utils v1.0.0
matrixUtils
@definitelynotsam/matrix-utils
Objective
Javascript library with methods to loop through, create and clone multidimensional arrays
Install
npm install @definitelynotsam/matrix-utils
How to use
const matrixUtils = require('@definitelynotsam/matrix-utils');
const testMatrix = [
[-1, -1],
[-1, 0],
[-1, 1],
[0, 1],
[1, 1],
[1, 0],
[1, -1],
[0, -1],
];
console.log(matrixUtils.loopMatrix(testMatrix));
const newMatrix = matrixUtils.createMatrix(5, 5, () => Math.random() >= 0.6);
console.log(newMatrix);
const newMatrixClone = matrixUtils.cloneMatrix(newMatrix);
console.log(newMatrix === newMatrixClone);
1.0.0
5 years ago