Skip to content

mskashef/array2matrix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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).

About

Array to matrix converter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published