This is the best[tm] way to manage multi-dimensional arrays (of any type).
It's about arrays (of any type) without really nesting them,
but access with multi-dimensional coordinates. These coordinates
are calculated, similar to radix/base conversions. That's also
the reason why you even can use any TypedArray which doesn't
really support nesting 'em.
You can either use the dimensions and/or calculated offsets, or directly the concrete data (if you've set an array before). In both directions, so calculation of offsets and also coordinates.
- JavaScript [Version v1.0.0; Last update: 2025-03-12];
- Bash Shell [Version v1.0.0; Last update: 2025-03-12];
Note
The JavaScript variant is a bit bigger, and calculates with BigInt.
For more radix/base/unit/.. conversion and numeric JavaScript extensions
see also my Radix repository!
The Copyright is (c) Sebastian Kucharczyk, and it's licensed under the MIT (also known as 'X' or 'X11' license).