Wraps array with two dimensions for grid access.
Immutable, such that underlying array is not modified and a
call to set returns a new GridArray1d.
// Grid of rows: 2, cols: 3 constmyArray = [ [ `a`, `b`, `c` ], [ `d`, `e`, `f` ] ] letg = wrap(myArray); g.get({x:1,y:2}); // Get value at cell position g = g.set(10, {x:1,y:2}); // Set value at cell position g.array; // Get reference to current array
Wraps
array
with two dimensions for grid access. Immutable, such that underlying array is not modified and a call toset
returns a newGridArray1d
.Use wrapMutable to modify an array in-place