array-unflat
The opposite of Array.prototype.flat() with depth = 1.
Useful to convert one-dimensional arrays [x, y, z, x, y, z]
into two-dimensional arrays [[x, y, z], [x, y, z]]
i.e. for simplicial complex.
Install
npm install array-unflat
Example
const unflat = ; const arr = 02 03 05 -18 29 11;console;console;
Output:
02 03 05 -18 29 11 02 03 05 -18 29 11
Usage
unflat(arr, size)
-
arr
the flattened array -
size
(default2
) length of the grouped subarrays
Returns a two-dimensional array.
License
MIT, see LICENSE for details.