hypera
v1.0.1
Published
Simple to use module for creating multi-dimensional arrays
Downloads
7
Maintainers
Readme
Hypera
Hypera is a simple to use module that allows you to create multi-dimensional arrays in an instant.
Installation
$ npm i hypera
Usage
Hypera module is imported into your project like this:
const Hypera = require('hypera')();
You can also pass in an argument that will serve as the default value for all the elements of the array:
(If no argument is passed, the default value will be set to null
.)
const Hypera = require('hypera')(false);
In this case, I'm setting the default value to false
.
After importing the module, you can use it like this:
// This will create a 2-dimensional array with 3 rows and 3 columns:
let array = Hypera(3,3);
/* [ [ null, null, null ],
[ null, null, null ],
[ null, null, null ] ] */
Now you can create arrays with as many dimensions as you need.
For example, creating a 5-dimensional array where all the dimensions have a length of 3 would look like this:
let array = Hypera(3,3,3,3,3);
License
MIT