@mskashef/array2matrix

1.0.1 • Public • Published

Array to Matrix converter

Sample Usage

const a2m = require("@mskashef/array2matrix");
const array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
console.log(a2m(array, 3));
/*
OUTPUT:
[
  [1, 2, 3, 4],
  [5, 6, 7, 8],
  [9,10,11,12]
]
*/

API Document

Input Params

This function requires two input params:

  1. array: The array we want to convert to matrix
  2. rowsLength: the length of the matrix rows

Output

It converts that array to a matrix then returns it (returns an array of arrays).

Package Sidebar

Install

npm i @mskashef/array2matrix

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

3.03 kB

Total Files

4

Last publish

Collaborators

  • mskashef